/* お金の地図帳：共通スタイル
   方針：静かな帳面（紙色と藍色のインク）＋結果だけ電卓の液晶。詳細は 04_design_plan.md */
:root {
  --paper: #f2f3ef;
  --sheet: #fbfbf8;
  --ink: #1f2733;
  --ink-soft: #545d69;
  --rule: #d6dbd3;
  --indigo: #23396b;
  --indigo-soft: #e3e8f2;
  --lcd: #c8d1b0;
  --lcd-ink: #1d2617;
  --lcd-dim: #6c7a5c;
  --warn: #b23a2a;
  --safe: #2f6b45;
  --display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", sans-serif;
  --body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161a1f; --sheet: #1d2228; --ink: #e6e8ea; --ink-soft: #a4abb3; --rule: #313840;
    --indigo: #9fb4e6; --indigo-soft: #232c40; --lcd: #3b4430; --lcd-ink: #e2ecc7; --lcd-dim: #a9b693;
    --warn: #f08b79; --safe: #7cc797; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161a1f; --sheet: #1d2228; --ink: #e6e8ea; --ink-soft: #a4abb3; --rule: #313840;
  --indigo: #9fb4e6; --indigo-soft: #232c40; --lcd: #3b4430; --lcd-ink: #e2ecc7; --lcd-dim: #a9b693;
  --warn: #f08b79; --safe: #7cc797; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.85;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--indigo); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--indigo); outline-offset: 2px;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.4; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.3em; }

.site-header, .site-footer, main { max-width: 42rem; margin: 0 auto; }
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px;
  padding-block: 18px 14px; border-bottom: 2px solid var(--indigo);
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand small { font-family: var(--body); font-weight: 400; font-size: .8rem; color: var(--ink-soft); margin-left: .6em; }
.site-nav { display: flex; gap: 16px; font-size: .9rem; }

main { display: grid; gap: 44px; padding-block: 32px 56px; }
section { display: grid; gap: 14px; }
.lead { color: var(--ink-soft); }
.note { font-size: .88rem; color: var(--ink-soft); }
.updated { font-size: .85rem; color: var(--ink-soft); }

/* 帳面の紙：罫線つきの面。入力欄と解説の囲みに使う */
.sheet {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 18px;
  display: grid; gap: 16px;
}

/* トップ：問いの一覧 */
.questions { list-style: none; padding: 0; display: grid; border-top: 1px solid var(--rule); }
.questions li { border-bottom: 1px solid var(--rule); }
.questions a { display: grid; gap: 2px; padding: 16px 4px; text-decoration: none; color: var(--ink); }
.questions a:hover .q { text-decoration: underline; }
.questions .q { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--indigo); }
.questions .tool { font-size: .9rem; color: var(--ink-soft); }
.questions .soon { padding: 16px 4px; color: var(--ink-soft); display: grid; gap: 2px; }
.questions .soon .q { color: var(--ink-soft); }

/* 入力 */
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 700; }
.field .hint { font-size: .85rem; color: var(--ink-soft); }
fieldset { border: 0; padding: 0; margin: 0; }
.ages { display: flex; flex-wrap: wrap; gap: 8px; }
.ages label { font-weight: 400; }
.ages input { position: absolute; opacity: 0; pointer-events: none; }
.ages span {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--paper); cursor: pointer;
}
.ages input:checked + span { background: var(--indigo); border-color: var(--indigo); color: var(--sheet); }
.ages input:focus-visible + span { outline: 3px solid var(--indigo); outline-offset: 2px; }
.money { display: flex; align-items: center; gap: 8px; }
.money input[type="number"] {
  width: 9em; font: inherit; font-size: 1.2rem; padding: 8px 10px; text-align: right;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
input[type="range"] { width: 100%; accent-color: var(--indigo); }

/* 結果：電卓の液晶（このサイトで唯一の大胆な要素） */
.lcd {
  background: var(--lcd); color: var(--lcd-ink); border-radius: 10px; padding: 18px 18px 14px;
  box-shadow: inset 0 2px 0 rgba(0,0,0,.08); display: grid; gap: 4px;
}
.lcd-head { font-size: .85rem; color: var(--lcd-dim); }
.lcd-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline;
  padding-block: 10px; border-top: 1px dashed color-mix(in srgb, var(--lcd-ink) 25%, transparent);
}
.lcd-row:first-of-type { border-top: 0; }
.lcd-label { font-size: .95rem; min-width: 0; }
.lcd-value {
  font-family: var(--display); font-weight: 700; font-size: 1.45rem; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.lcd-sub { grid-column: 1 / -1; font-size: .85rem; color: var(--lcd-dim); }
.lcd .mark-warn { color: var(--warn); }
.lcd.flash .lcd-value { animation: lcdflash .35s ease-out; }
@keyframes lcdflash { from { opacity: .25; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lcd.flash .lcd-value { animation: none; } }

/* 壁の数直線 */
.line-wrap { overflow-x: auto; }
.wallline { width: 100%; min-width: 520px; height: auto; display: block; }
.wall-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.wall-list li { display: grid; grid-template-columns: 5.2em 2.2em 1fr; gap: 8px; align-items: baseline; }
.wall-list .at { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.wall-list .who { font-size: .8rem; border: 1px solid var(--rule); border-radius: 4px; text-align: center; }
.wall-list li.passed .at { color: var(--warn); }
.wall-list li.passed .text::after { content: "（超えています）"; color: var(--warn); font-size: .85rem; }

/* 表 */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); }
table { border-collapse: collapse; width: 100%; min-width: 30em; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; color: var(--ink-soft); font-size: .85rem; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.caution { border-left: 4px solid var(--warn); padding: 10px 14px; background: var(--sheet); }
.sources { font-size: .9rem; }
.sources li { word-break: break-all; }
details { border-top: 1px solid var(--rule); padding-block: 12px; }
details summary { cursor: pointer; font-weight: 700; }
details p { margin-top: 8px; }

.site-footer {
  border-top: 1px solid var(--rule); padding-block: 20px 36px; font-size: .85rem; color: var(--ink-soft);
  display: grid; gap: 8px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
td.nowrap { white-space: nowrap; }
td.num.left { text-align: left; }

/* 出産・育児シミュレーター */
.pair { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(16em, 1fr)); }
.pair > fieldset { min-width: 0; display: grid; gap: 12px; border-top: 3px solid var(--indigo); padding-top: 12px; }
.pair legend { font-family: var(--display); font-size: 1.1rem; padding: 0; margin-bottom: 4px; }
select { font: inherit; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); max-width: 100%; }
input:disabled, select:disabled { opacity: .45; }
.lcd-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding-bottom: 10px; border-bottom: 2px solid color-mix(in srgb, var(--lcd-ink) 35%, transparent); }
.lcd-total .lcd-value { font-size: 2rem; }
.lcd-value.zero { color: var(--lcd-dim); font-weight: 400; }

/* お問い合わせ */
input[type="text"], input[type="email"], textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.button { font: inherit; font-weight: 700; padding: 10px 22px; border: 0; border-radius: 6px; background: var(--indigo); color: var(--sheet); cursor: pointer; }
