/* マネーライフ・シミュレーター 共通スタイル
   方針: 50〜60代の事業主でも読みやすいUDフォント・大きめの文字。
   色は藍（信頼）を基調に、増減の色は数字にだけ使う。 */

:root {
  --ink: #1d2733;
  --ink-soft: #4a5868;
  --paper: #f6f8fb;
  --surface: #ffffff;
  --line: #d5dde7;
  --ai: #1f3a5f;         /* 藍 */
  --ai-tint: #e6edf6;
  --plus: #1d6e52;
  --minus: #a3402a;
  --gold: #b48a1c;
  --focus: #2f6fd1;
  --sole: #7b8794;

  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-num: "BIZ UDGothic", "BIZ UDPGothic", monospace;
  --font-head: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.3rem;
  --step-4: 3.2rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7ecf2; --ink-soft: #a9b5c3; --paper: #121820; --surface: #1a222c;
    --line: #2f3a47; --ai: #8fb3e3; --ai-tint: #1f2c3c; --plus: #5fc39a; --minus: #ec8a70;
    --gold: #e0b94a; --focus: #7fb0ff; --sole: #8b97a5;
  }
}
:root[data-theme="dark"] {
  --ink: #e7ecf2; --ink-soft: #a9b5c3; --paper: #121820; --surface: #1a222c;
  --line: #2f3a47; --ai: #8fb3e3; --ai-tint: #1f2c3c; --plus: #5fc39a; --minus: #ec8a70;
  --gold: #e0b94a; --focus: #7fb0ff; --sole: #8b97a5;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.8;
  font-feature-settings: "palt" 0;
}

a { color: var(--ai); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.prose { max-width: 40rem; }

/* ヘッダー・フッター */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; flex-wrap: wrap; }
.site-name { font-family: var(--font-head); font-size: var(--step-1); color: var(--ink); text-decoration: none; letter-spacing: 0.04em; }
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: var(--step--1); }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ai); font-weight: 700; }

.site-footer { margin-top: 5rem; padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: var(--step--1); }
.site-footer p { margin: 0.25rem 0; }

/* 見出し */
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.4; letter-spacing: 0.02em; }
h1 { font-size: var(--step-3); margin: 0; }
h2 { font-size: var(--step-2); margin: 3.5rem 0 1rem; }
h3 { font-size: var(--step-1); margin: 2rem 0 0.5rem; }

.lead { color: var(--ink-soft); margin: 0.75rem 0 0; max-width: 40rem; }

/* トップページ */
.home-hero { padding: 3.5rem 0 2rem; }
.home-hero h1 { font-size: clamp(2rem, 5vw, var(--step-4)); max-width: 18em; }
.tool-list { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tool-list li { background: var(--surface); }
.tool-entry { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 2rem; padding: 1.5rem; text-decoration: none; color: inherit; }
.tool-entry h2 { margin: 0; font-size: var(--step-1); color: var(--ai); }
.tool-entry p { margin: 0; color: var(--ink-soft); grid-column: 1; }
.tool-entry .status { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: var(--step--1); color: var(--ink-soft); white-space: nowrap; }
a.tool-entry:hover h2 { text-decoration: underline; }
.tool-entry.is-soon h2 { color: var(--ink-soft); }

/* ツールページ */
.tool-head { padding: 2.5rem 0 1.5rem; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 860px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
.tool-grid > * { min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; }
.inputs { position: sticky; top: 1rem; }
@media (max-width: 860px) { .inputs { position: static; } }

fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 700; margin-bottom: 0.5rem; padding: 0; }
.field { margin-bottom: 1rem; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: var(--step--1); margin-bottom: 0.3rem; }
.field .hint { display: block; font-size: var(--step--1); color: var(--ink-soft); line-height: 1.6; margin-top: 0.25rem; }

input[type="number"], select {
  width: 100%;
  font: inherit;
  font-family: var(--font-num);
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}
select { font-family: var(--font-body); }
.with-unit { display: flex; align-items: center; gap: 0.5rem; }
.with-unit span { white-space: nowrap; color: var(--ink-soft); }
.radio-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-row label { display: inline-flex; gap: 0.35rem; align-items: center; font-weight: 400; font-size: var(--step-0); }
input[type="radio"], input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--ai); }
.is-hidden { display: none !important; }

/* 結果 */
.verdict { padding: 1.5rem 1.25rem; }
.verdict-label { margin: 0; color: var(--ink-soft); }
.verdict-amount { font-family: var(--font-head); font-size: clamp(2.2rem, 6vw, var(--step-4)); line-height: 1.2; margin: 0.25rem 0 0.5rem; font-variant-numeric: tabular-nums; }
.verdict-amount.is-plus { color: var(--plus); }
.verdict-amount.is-minus { color: var(--minus); }
.verdict-note { margin: 0; }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--plus); }
.minus { color: var(--minus); }

.salary-control { margin-top: 1.5rem; }
.salary-control output { font-family: var(--font-num); font-size: var(--step-1); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--ai); height: 2rem; }
.salary-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }

button {
  font: inherit; font-size: var(--step--1);
  padding: 0.45rem 0.9rem; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--ai); background: var(--surface); color: var(--ai);
}
button.primary { background: var(--ai); color: var(--surface); }
button:hover { filter: brightness(1.08); }

.chart-box { margin-top: 1.5rem; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-soft); margin: 0.5rem 0 0; padding: 0; list-style: none; }
.chart-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { display: inline-block; width: 1.5rem; height: 0; border-top: 3px solid currentColor; }
.swatch.dashed { border-top-style: dashed; }

/* 比較表 */
.compare { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: var(--step--1); }
.compare th, .compare td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); text-align: right; }
.compare th:first-child, .compare td:first-child { text-align: left; min-width: 9em; }
.compare { min-width: 34rem; }
.compare thead th { font-weight: 700; color: var(--ink-soft); border-bottom: 2px solid var(--ink); vertical-align: bottom; }
.compare tbody th { font-weight: 400; }
.compare tr.sub th { padding-left: 1.25rem; color: var(--ink-soft); }
.compare tr.total th, .compare tr.total td { font-weight: 700; border-top: 2px solid var(--ink); font-size: var(--step-0); }
.table-scroll { overflow-x: auto; }

.notice { border-left: 4px solid var(--gold); background: var(--surface); padding: 0.9rem 1rem; margin: 1.25rem 0 0; font-size: var(--step--1); }
.notice p { margin: 0.25rem 0; }

.facts { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; font-size: var(--step--1); }
.facts li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dotted var(--line); padding-bottom: 0.4rem; }

.assumptions { font-size: var(--step--1); color: var(--ink-soft); }
.assumptions li { margin-bottom: 0.35rem; }

.sources { font-size: var(--step--1); }
.sources li { margin-bottom: 0.3rem; }

.updated { font-size: var(--step--1); color: var(--ink-soft); }

@media (prefers-reduced-motion: no-preference) {
  .verdict-amount { transition: color 0.2s; }
}

/* パンくず */
.breadcrumb { margin-top: 1.25rem; font-size: var(--step--1); color: var(--ink-soft); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.breadcrumb li + li::before { content: "›"; margin-right: 0.35rem; color: var(--ink-soft); }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb + .tool-head { padding-top: 1rem; }

/* 国保ページ */
.compare caption { text-align: left; font-weight: 700; padding: 0 0 0.5rem; color: var(--ink); }
.cell-note { display: block; font-size: 0.8em; color: var(--ink-soft); font-weight: 400; }
.compare tr.is-self th, .compare tr.is-self td { background: var(--ai-tint); }
.prose.wide { max-width: 52rem; }
.ranking { min-width: 30rem; }
.feature-list { font-size: var(--step--1); margin-top: 1rem; }
.feature-list li { margin-bottom: 0.35rem; }
.city-links { list-style: none; padding: 0; margin: 0.25rem 0 1rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; }
.cta-link { display: inline-block; padding: 0.6rem 1.1rem; border-radius: 4px; background: var(--ai); color: var(--surface); text-decoration: none; font-weight: 700; }
.cta-link:hover { filter: brightness(1.1); }
.compare tbody th[scope="row"] { text-align: left; }
#kbreakdown { min-width: 0; }
.radio-row.stacked { flex-direction: column; gap: 0.35rem; }
.radio-row.stacked label, label.check { font-weight: 400; font-size: var(--step-0); display: inline-flex; gap: 0.4rem; align-items: flex-start; }
label.check input { margin-top: 0.35rem; }
.field label + .with-unit { margin-top: 0; }
.site-name { display: inline-flex; align-items: center; gap: 0.55rem; }
.site-name img { width: 32px; height: 32px; flex: none; }

/* 年金の受け取り方の選択 */
.pick-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.pick-row .field { margin: 0; }
p.hint { font-size: var(--step--1); color: var(--ink-soft); line-height: 1.6; }
.compare td.note { text-align: left; font-size: var(--step--1); color: var(--ink-soft); }
.verdict-amount.is-text { font-size: clamp(1.5rem, 5vw, var(--step-3)); overflow-wrap: anywhere; word-break: keep-all; }
.related { margin: 1.5rem 0 0; font-size: var(--step--1); color: var(--ink-soft); }

/* ツールのアイコン */
.tool-entry { grid-template-columns: auto 1fr auto; }
.tool-entry .tool-icon { grid-column: 1; grid-row: 1 / span 2; width: 72px; height: 72px; align-self: center; }
.tool-entry h2, .tool-entry p { grid-column: 2; }
.tool-entry .status { grid-column: 3; }
.tool-head.has-icon { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0.25rem 1.5rem; align-items: center; }
.tool-head-icon { grid-row: 1 / span 2; width: 96px; height: 96px; }
.tool-head.has-icon h1, .tool-head.has-icon .lead { grid-column: 2; margin-top: 0; }
@media (max-width: 600px) {
  .tool-entry { gap: 0.25rem 1rem; padding: 1.25rem 1rem; }
  .tool-entry .tool-icon { width: 56px; height: 56px; }
  .tool-head.has-icon { grid-template-columns: 64px minmax(0, 1fr); gap: 0.5rem 1rem; }
  .tool-head-icon { grid-row: 1; width: 64px; height: 64px; }
  .tool-head.has-icon .lead { grid-column: 1 / -1; }
}

/* 入力のリセット */
.reset-row { margin: 1.25rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.reset-input { font: inherit; font-size: var(--step--1); padding: 0.4rem 0.9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.reset-input:hover { color: var(--ink); border-color: var(--ink-soft); }
.reset-row .hint { font-size: var(--step--1); color: var(--ink-soft); }
