/* サイト共通の見た目。色はここだけで決める */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b636b;
  --line: #e2ddd3;
  --accent: #1f6f5c;
  --accent-soft: #e5f2ee;
  --warn: #9a4b00;
  --warn-soft: #fdf1e3;
  --chart-net: #1f6f5c;
  --chart-household: #b0651e;
  --chart-wall: #a3a9b0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b; --surface: #1d2125; --text: #e7e9eb; --muted: #a3abb3; --line: #33393f;
    --accent: #5fc2a6; --accent-soft: #1b302b; --warn: #f0a35c; --warn-soft: #33271b;
    --chart-net: #5fc2a6; --chart-household: #e9a15c; --chart-wall: #6b737b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.75; font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 52px; gap: 12px; }
.site-name { font-weight: 700; text-decoration: none; color: var(--text); }
.site-header nav a { font-size: 14px; color: var(--muted); }

.ad-notice {
  margin: 16px 0; padding: 8px 12px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}

h1 { font-size: 1.5rem; line-height: 1.45; margin: 16px 0 8px; }
h2 { font-size: 1.2rem; margin: 40px 0 12px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.lead { color: var(--muted); margin-top: 0; }
.updated { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 16px 0; }

/* 入力 */
.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.money { display: flex; align-items: center; gap: 6px; }
input[type="number"], select {
  font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); width: 100%; max-width: 220px;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--bg); cursor: pointer; font-size: 15px;
}
.choices input { accent-color: var(--accent); }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* 結果 */
.result-main { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { background: var(--accent-soft); border-radius: 8px; padding: 12px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 13px; color: var(--muted); }
.callout { border-left: 4px solid var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 4px; margin: 12px 0; }
.callout.good { border-color: var(--accent); background: var(--accent-soft); }

table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; }

/* 紹介枠（広告）。リンクが無いときは出さない */
.promo { border: 1px dashed var(--line); border-radius: 10px; padding: 16px; margin: 24px 0; background: var(--surface); }
.promo .pr { font-size: 12px; color: var(--muted); }
.promo a.btn {
  display: inline-block; margin-top: 8px; padding: 10px 16px; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
}

.faq dt { font-weight: 600; margin-top: 16px; }
.faq dd { margin: 4px 0 0; }
.sources { font-size: 14px; }
.sources li { margin: 4px 0; }

.site-footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 16px 0 32px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); }

.tool-list { list-style: none; padding: 0; }
.tool-list li { margin: 12px 0; }
.tool-list a { font-weight: 600; }
