/* 結婚新生活の補助金早見：ふたりの新居の間取り図。方眼の製図用紙・墨の壁・木の床・タイルの水回り、物件チラシの赤い値札
   字体は見出しに M PLUS 1 の 800（チラシの太字。Dela Gothic One は太すぎて字の中が潰れたので替えた 12/1 採点）、本文 Noto Sans JP、寸法と数字に Roboto Condensed。端末の明暗によらず紙の色で見せる */
:root {
  --paper: #f8f6f1; --grid: #e7e2d6; --grid-b: #d9d2c2; --wall: #2b2a28; --ink: #2b2a28; --muted: #6e695f; --line: #d8d1c1;
  --wood: #e8d2ae; --wood-2: #dcc195; --tile: #d9e6ec; --tile-2: #c4d6df; --stone: #e3e0da; --sheet: #fffdf9;
  --red: #c43c27; --red-soft: #fbe3dc; --sage: #6f8f76; --brass: #b98a2e;
  --head: "M PLUS 1", "Hiragino Sans", sans-serif;
  --body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --num: "Roboto Condensed", "Arial Narrow", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); color-scheme: light; }
body { margin: 0; color: var(--ink); font-family: var(--body); line-height: 1.8; font-size: 16px;
  background: var(--paper) linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 16px 16px; }
body { background-color: var(--paper); }
a { color: #8a5a12; text-underline-offset: 3px; }
strong { font-weight: 700; }

/* 頭：図面の表題欄 */
.site-header { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px; padding: 12px 16px 10px; background: var(--sheet); border-bottom: 4px solid var(--wall); box-shadow: 0 3px 0 var(--sheet), 0 4px 0 var(--wall); }
.site-name { font-family: var(--head); font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.05rem; letter-spacing: 0.02em; }
.site-header::after { content: "S=1/100"; grid-column: 2; grid-row: 1; font-family: var(--num); font-weight: 700; font-size: 0.8rem; color: var(--muted); border: 1.5px solid var(--muted); padding: 0 6px; }
.pr-notice { grid-column: 1 / -1; margin: 0; font-size: 0.8rem; color: var(--muted); }
.site-main { max-width: 760px; margin: 0 auto; padding: 18px 16px 28px; }

h1, h2 { font-family: var(--head); font-weight: 800; letter-spacing: 0.03em; }
h1 { line-height: 1.3; margin: 0 0 12px; }
/* 見出し：寸法線。両はしに止めの線、真ん中に見出し */
h2 { position: relative; margin: 52px 0 16px; padding: 0 0 12px; font-size: 1.25rem; line-height: 1.45; letter-spacing: 0.02em; }
h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px;
  background: linear-gradient(var(--wall), var(--wall)) 0 50% / 100% 1.5px no-repeat, linear-gradient(var(--wall), var(--wall)) 0 0 / 1.5px 100% no-repeat, linear-gradient(var(--wall), var(--wall)) 100% 0 / 1.5px 100% no-repeat; }
h2::before { content: ""; position: absolute; right: 0; top: 4px; width: 12px; height: 12px; border: 2px solid var(--red); border-radius: 50%; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.lead { font-size: 0.97rem; }
.hint, .source { font-size: 0.94rem; color: var(--muted); }
.hint { margin: 4px 0 0; }
.source { margin: 6px 0 0; overflow-wrap: anywhere; }

/* はじめ：新居の間取り図と、チラシの値札 */
.hero { margin: 4px 0 14px; }
.plan { position: relative; display: grid; grid-template-columns: 1fr 1.7fr; grid-template-rows: 92px 64px; grid-template-areas: "bed ldk" "wet ldk"; gap: 0; margin: 0 0 18px; padding: 6px;
  background: var(--wall); border-radius: 2px; box-shadow: 6px 6px 0 rgba(43, 42, 40, 0.12); }
.rm { position: relative; display: grid; align-content: center; justify-items: center; margin: 3px; background: var(--wood); font-family: var(--num); }
.rm b { font-family: var(--head); font-weight: 800; font-size: 0.95rem; line-height: 1.1; }
.rm small { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.rm-bed { grid-area: bed; background: repeating-linear-gradient(90deg, var(--wood) 0 13px, var(--wood-2) 13px 14px); }
.rm-ldk { grid-area: ldk; background: repeating-linear-gradient(90deg, var(--wood) 0 17px, var(--wood-2) 17px 18px); }
.rm-wet { grid-area: wet; background: var(--tile) linear-gradient(var(--tile-2) 1px, transparent 1px) 0 0 / 10px 10px, linear-gradient(90deg, var(--tile-2) 1px, transparent 1px) 0 0 / 10px 10px; background-color: var(--tile); }
.rm-ent { position: absolute; right: 18px; bottom: -34px; width: 74px; height: 40px; margin: 0; border: 3px solid var(--wall); border-top: 0; background: var(--stone); }
.rm-ent b { font-size: 0.94rem; }
.door { position: absolute; left: -3px; top: -3px; width: 30px; height: 30px; border-left: 2px solid var(--wall); border-top: 0; border-bottom-right-radius: 30px; box-shadow: inset -1px -1px 0 var(--wall); }
.sofa { position: absolute; left: 12px; bottom: 10px; width: 46px; height: 18px; border: 2px solid var(--wall); border-radius: 4px 4px 8px 8px; }
.sofa::after { content: ""; position: absolute; left: 52px; bottom: -2px; width: 22px; height: 22px; border: 2px solid var(--wall); border-radius: 50%; }
/* 家具：ベッド（枕つき）・食卓と椅子・観葉植物・浴槽。線は壁と同じ墨 */
.bed { position: absolute; left: 10%; bottom: 10%; width: 34%; height: 58%; border: 2px solid var(--wall); border-radius: 3px; background: #fbf7ef; }
.bed::before { content: ""; position: absolute; left: 12%; right: 12%; top: 6%; height: 18%; border: 1.5px solid var(--wall); border-radius: 6px; background: #fff; }
.bed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52%; border-top: 1.5px solid var(--wall); background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(196, 60, 39, 0.18) 5px 7px); }
.table { position: absolute; right: 16%; top: 42%; width: 30%; height: 26%; border: 2px solid var(--wall); border-radius: 2px; background: #f3e4c8; }
.table::before, .table::after { content: ""; position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border: 2px solid var(--wall); border-radius: 3px; background: var(--wood); }
.table::before { left: -18px; } .table::after { right: -18px; }
.plant { position: absolute; right: 8px; bottom: 8px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle, #8fae94 0 30%, var(--sage) 31% 60%, transparent 61%), conic-gradient(from 20deg, var(--sage) 0 12%, transparent 0 25%, var(--sage) 0 37%, transparent 0 50%, var(--sage) 0 62%, transparent 0 75%, var(--sage) 0 87%, transparent 0); }
.tub { position: absolute; right: 10%; top: 18%; width: 30%; height: 64%; border: 2px solid var(--wall); border-radius: 10px; background: #eef5f8; }
.rm-bed b, .rm-bed small { position: relative; left: 18%; }
.rm-wet b { position: relative; left: -16%; }
.rm-ldk b, .rm-ldk small { position: relative; top: 14%; left: -10%; }
.tag { position: absolute; right: 6px; top: -14px; margin: 0; padding: 4px 12px 6px; background: var(--red); color: #fff; text-align: center; line-height: 1.15; font-weight: 700; font-size: 0.8rem; transform: rotate(3deg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%); }
.tag small { display: block; font-size: 0.8rem; opacity: 0.9; }
.tag b { display: block; font-family: var(--num); font-size: 1.8rem; letter-spacing: -0.01em; }
.h1-a { display: block; font-size: 0.95rem; color: #4f6f56; letter-spacing: 0.06em; }
.h1-b { display: block; font-size: 2.1rem; line-height: 1.25; font-weight: 900; color: #231f1c; }
h1 .sub { display: block; margin-top: 8px; font-family: var(--body); font-weight: 700; font-size: 0.94rem; color: var(--muted); }

/* 注意：赤い付せん */
.caution { margin: 16px 0 20px; padding: 10px 14px 10px 16px; background: var(--red-soft); border-left: 6px solid var(--red); font-size: 0.94rem; }
.caution p { margin: 0; }

/* 早見：設計の図面の一枚。壁で囲み、角に出入口 */
.card { position: relative; background: var(--sheet); border: 5px solid var(--wall); padding: 22px 16px 18px; }
.card::before { content: ""; position: absolute; right: 28px; top: -5px; width: 46px; height: 5px; background: var(--sheet); }
.card::after { content: ""; position: absolute; right: 28px; top: 0; width: 46px; height: 46px; border-top: 2px solid var(--wall); border-right: 2px solid var(--wall); border-top-right-radius: 46px; opacity: 0.35; }
.hayami h2 { margin-top: 0; font-size: 1rem; padding-right: 56px; }
.hayami h2::before { display: none; }
.hayami .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 14px 0 4px; letter-spacing: 0.04em; }
input, select, button { font: inherit; }
input[type="text"], select { width: 100%; min-height: 48px; padding: 8px 12px; border: 2px solid var(--wall); border-radius: 0; background: #fff; color: var(--ink); font-weight: 700; }
input[type="text"] { font-family: var(--num); font-size: 1.15rem; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); background: var(--red-soft); }
.err { color: var(--red); font-size: 0.8rem; min-height: 1.1em; margin: 2px 0 0; font-weight: 700; }
.unit-wrap { position: relative; }
.unit-wrap input { padding-right: 52px; }
.unit-wrap .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.85rem; pointer-events: none; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
button { min-height: 48px; padding: 8px 20px; border: 2px solid var(--wall); border-radius: 0; background: var(--wall); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 4px 4px 0 var(--red); transition: transform 0.1s, box-shadow 0.1s; }
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--red); }
button.secondary { background: #fff; color: var(--ink); box-shadow: 4px 4px 0 var(--grid-b); }

/* 結果：チラシの値札 */
.result { position: relative; margin-top: 18px; padding: 14px 14px 12px; border: 2px dashed var(--wall); background: #fff; }
.result .verdict { margin: 0; font-family: var(--head); font-weight: 800; font-size: 1.2rem; line-height: 1.4; }
.result[data-verdict="対象"] .verdict { color: var(--sage); }
.result[data-verdict="対象外"] .verdict, .result[data-open="0"] .verdict { color: var(--muted); }
.result .capline { display: inline-block; margin: 6px 0 8px; padding: 2px 14px; background: var(--red); color: #fff; font-family: var(--num); font-weight: 700; font-size: 2rem; line-height: 1.3; font-variant-numeric: tabular-nums; transform: rotate(-1.5deg); }
.result .capline:empty { display: none; }
.result ul { padding-left: 1.2em; font-size: 0.94rem; margin: 6px 0; }
.summary { padding: 10px 14px; background: var(--sheet); border: 2px solid var(--wall); font-size: 0.94rem; }
.updated { text-align: center; font-size: 0.94rem; color: var(--muted); margin-top: 32px; }

/* 日本地図：方眼のマスを木の床の濃さで */
.jmap { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); grid-template-rows: repeat(12, auto); gap: 2px; max-width: 560px; margin: 14px auto 4px; padding: 8px; background: var(--sheet); border: 3px solid var(--wall); }
.tile { aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; overflow: hidden; text-decoration: none; color: var(--ink); font-size: 0.8rem; line-height: 1.1; letter-spacing: -0.05em; border: 1px solid var(--grid-b); }
.tile span { white-space: nowrap; }
.tile b { font-family: var(--num); font-size: 0.8rem; letter-spacing: 0; }
.b80 { background: var(--red); color: #fff; border-color: var(--red); }
.b60 { background: #e9876f; color: #2b1510; border-color: #e9876f; }
.b30 { background: var(--wood-2); border-color: #c9ab78; }
.b15 { background: var(--wood); }
.b0 { background: transparent; color: var(--muted); border-style: dashed; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; font-size: 0.8rem; margin: 8px 0; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--grid-b); vertical-align: -1px; margin-right: 4px; }
.legend .sw.b0 { border-style: dashed; }
@media (min-width: 560px) { .tile { font-size: 0.8rem; } .tile b { font-size: 0.86rem; } }

/* 表 */
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; background: var(--sheet); }
th, td { border: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
thead th { background: var(--wall); color: #fff; font-size: 0.8rem; border-color: var(--wall); }
#rank-table td:first-child { white-space: nowrap; font-family: var(--num); font-weight: 700; }
#rank-table td:nth-child(4) { font-size: 0.8rem; }
#rank-table th, #rank-table td { padding: 6px; }
#rank-table .num { white-space: nowrap; font-family: var(--num); font-weight: 700; font-size: 1.05rem; color: var(--red); }
#rank-table small { color: var(--muted); }
#rank-table tbody tr:nth-child(-n+3) td:first-child { background: var(--red); color: #fff; }

/* 条件の分布 */
.dists { display: grid; gap: 12px; }
@media (min-width: 640px) { .dists { grid-template-columns: 1fr 1fr; } }
.dist { margin: 0; padding: 12px; background: var(--sheet); border: 2px solid var(--wall); }
.dist figcaption { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.dist ul { list-style: none; padding: 0; margin: 0; }
.dist li { display: grid; grid-template-columns: 9.5em 1fr 3em; align-items: center; gap: 6px; font-size: 0.94rem; margin: 4px 0; }
.dist .bar { height: 12px; background: linear-gradient(90deg, var(--sage) var(--w), var(--stone) var(--w)); }
.dist .dn { text-align: right; font-family: var(--num); font-weight: 700; }
.dist .dsum { font-size: 0.8rem; color: var(--muted); margin: 4px 0 0; text-align: right; }

/* 市ごとの札：物件カード */
.region h3 { font-family: var(--head); font-weight: 800; display: inline-block; padding: 2px 12px; background: var(--wall); color: #fff; font-size: 0.95rem; }
.fudas { display: grid; gap: 12px; }
@media (min-width: 640px) { .fudas { grid-template-columns: 1fr 1fr; } }
.fuda { position: relative; padding: 12px 14px; background: var(--sheet); border: 2px solid var(--wall); box-shadow: 4px 4px 0 var(--grid-b); scroll-margin-top: 12px; }
.fuda.off { border-style: dashed; border-color: var(--muted); background: transparent; box-shadow: none; }
.fuda h4 { margin: 0 0 2px; padding-right: 5em; font-size: 1.1rem; }
.fuda h4 small { font-size: 0.8rem; color: var(--muted); margin-left: 6px; font-weight: 400; }
.fuda .cap { margin: 0 0 6px; font-size: 0.9rem; }
.fuda .cap strong { font-family: var(--num); font-size: 1.6rem; color: var(--red); }
.fuda dl { margin: 0; font-size: 0.94rem; display: grid; grid-template-columns: 6.5em 1fr; gap: 2px 8px; }
.fuda dt { color: var(--muted); }
.fuda dd { margin: 0; overflow-wrap: anywhere; }
.fuda p { font-size: 0.94rem; }
.fuda:target { box-shadow: 0 0 0 4px var(--red); }
.st { position: absolute; top: 10px; right: 10px; padding: 1px 8px; font-size: 0.8rem; font-weight: 700; border: 1.5px solid var(--muted); color: var(--muted); }
.st-0 { border-color: var(--red); background: var(--red); color: #fff; }

/* よくある質問：たたむ */
.faq details { margin: 0 0 8px; background: var(--sheet); border: 2px solid var(--wall); }
.faq summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q"; flex: none; display: grid; place-items: center; width: 28px; height: 28px; background: var(--red); color: #fff; font-family: var(--num); }
.faq summary::after { content: "+"; margin-left: auto; font-family: var(--num); font-size: 1.3rem; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 14px 14px 50px; font-size: 0.94rem; }

ul { padding-left: 1.2em; }
.facts dt { font-weight: 700; margin-top: 8px; }
.facts dd { margin: 0 0 4px; }
.site-footer { margin-top: 48px; padding: 22px 16px; background: var(--wall); color: #c9c4b8; font-size: 0.94rem; text-align: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; }
.site-footer a { color: #fff; }
.copyright { margin: 8px 0 0; }
.ad-slot { margin: 24px 0; }

/* PC：1 画面目を 2 列に（左＝間取り図と見出し、右＝早見）。下の地図・表も広く使う（12/1 採点「左右が空いている」） */
@media (min-width: 1024px) {
  .site-main { max-width: 1160px; padding: 28px 32px 40px; }
  .fv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 48px; align-items: start; }
  .fv .hero { display: block; }
  .fv .plan { grid-template-rows: 170px 120px; margin: 18px 0 44px; max-width: 520px; }
  .fv .h1-b { font-size: 3.1rem; }
  .fv .caution { margin-top: 22px; }
  .fv .hayami { margin-top: 18px; position: sticky; top: 16px; }
  .site-main > p, .site-main > section > p, .faq { max-width: 46em; }
  .jmap { max-width: 720px; }
}
@media (min-width: 760px) and (max-width: 1023.98px) {
  .hero { display: grid; grid-template-columns: 1fr 300px; gap: 0 28px; align-items: center; }
  .plan { grid-column: 2; grid-row: 1 / 3; grid-template-rows: 130px 90px; margin: 0; }
  .hero h1 { grid-column: 1; grid-row: 1; }
  .hero .lead { grid-column: 1; grid-row: 2; }
  .h1-b { font-size: 2.8rem; }
}

/* 動き：間取りの壁が引かれる・値札が下がって揺れる・見出しの寸法線が伸びる・ページの切り替え */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .plan { animation: draw 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .rm { animation: fill 0.5s both; }
  .rm-bed { animation-delay: 0.5s; } .rm-ldk { animation-delay: 0.62s; } .rm-wet { animation-delay: 0.74s; } .rm-ent { animation-delay: 0.86s; }
  .tag { animation: hang 1s 1s cubic-bezier(0.3, 1.5, 0.5, 1) both; transform-origin: 50% 0; }
  .result:not([hidden]) { animation: pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .reveal.is-in { opacity: 1; transform: none; }
  h2.reveal::after { transform: scaleX(0); transform-origin: left; transition: transform 0.8s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1); }
  h2.reveal.is-in::after { transform: none; }
  @keyframes draw { from { clip-path: inset(0 100% 100% 0); } to { clip-path: inset(-40px -40px -60px -40px); } }
  @keyframes fill { from { opacity: 0; } to { opacity: 1; } }
  @keyframes hang { 0% { transform: translateY(-30px) rotate(-10deg); opacity: 0; } 60% { transform: rotate(6deg); opacity: 1; } 100% { transform: rotate(3deg); } }
  @keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
}
