:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e4e0;
  --accent: #1f6f5c;
  --accent-soft: #e5f2ee;
  --warn-bg: #fff6e5;
  --warn-text: #7a4b00;
  --radius: 12px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141415; --surface: #1d1d1f; --text: #ececec; --muted: #a0a0a6;
    --line: #333336; --accent: #5cc2a6; --accent-soft: #1b2f2a;
    --warn-bg: #2e2616; --warn-text: #f0c674; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141415; --surface: #1d1d1f; --text: #ececec; --muted: #a0a0a6;
  --line: #333336; --accent: #5cc2a6; --accent-soft: #1b2f2a;
  --warn-bg: #2e2616; --warn-text: #f0c674; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); 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; height: 56px; }
.logo { font-weight: 700; text-decoration: none; color: var(--text); font-size: 17px; }
.logo span { color: var(--accent); }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 14px; margin-left: 16px; }

main { padding: 28px 0 48px; }
h1 { font-size: 26px; line-height: 1.4; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
h3 { font-size: 16px; margin: 24px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.updated { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit span { color: var(--muted); white-space: nowrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { font-weight: 400; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--accent); font-weight: 700; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.result { margin-top: 20px; background: var(--accent-soft); border-radius: var(--radius); padding: 20px; }
.result .label { font-size: 14px; color: var(--muted); }
.result .big { font-size: 34px; font-weight: 800; color: var(--accent); line-height: 1.3; font-variant-numeric: tabular-nums; }
.result .sub { font-size: 15px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 12px; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; }
tr.next td { background: var(--accent-soft); font-weight: 700; }

.note { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-top: 16px; }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tool:hover { border-color: var(--accent); }
.tool strong { display: block; font-size: 16px; margin-bottom: 4px; }
.tool span { font-size: 13px; color: var(--muted); }

details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }

/* 広告枠：AdSense 承認後に .ad-slot の中へ広告コードを入れ、hidden を外す */
.ad-slot { margin: 24px 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-slot[hidden] { display: none; }

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