/* 色は全てここで管理する */
:root {
  --bg: #FFFDF6;
  --soft: #FFF5D9;
  --accent: #E5C66E;
  --brand: #79591F;
  --brand-dark: #5F4615;
  --ink: #352D20;
  --muted: #5C5140;
  --line: #D5BA79;
  --line-soft: #EFE4C6;
  --white: #FFFFFF;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { color: var(--brand); line-height: 1.4; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .7em; }
small, .muted { color: var(--muted); }
.muted { font-size: .9rem; }
.fine { font-size: .84rem; color: var(--muted); margin: .4em 0 .7em; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 2000; background: var(--white); padding: 6px 10px; }
select, input[type="search"] { font: inherit; min-height: 42px; padding: 6px 10px; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; max-width: 100%; }

/* ヘッダーとフッター */
.site-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px; padding: 4px 16px; background: var(--white); border-bottom: 3px solid var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand img { display: block; border-radius: 7px; }
body[data-page="index"] .brand span { display: none; }
.site-menu { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.site-menu a { padding: 4px 10px; border-radius: 6px; color: var(--brand); text-decoration: none; font-size: .95rem; }
.site-menu a:hover { background: var(--soft); }
.site-menu a[aria-current="page"] { font-weight: 700; color: var(--brand-dark); box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
.site-foot { padding: 16px; border-top: 1px solid var(--line-soft); font-size: .92rem; background: var(--white); }
.site-foot p { margin: 0 0 .3em; }
.site-foot .foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0; }
.site-foot .foot-links a { display: inline-block; padding: 6px 0; font-weight: 700; }

/* 上部 */
.hero { padding: 12px 16px 6px; }
.hero h1 { margin: 0; }
.hero h1 a { color: inherit; text-decoration: none; }
.hero .sub { margin: 2px 0 0; color: var(--muted); }

/* 操作部分 */
.controls { display: grid; gap: 8px; padding: 6px 16px 10px; grid-template-columns: minmax(0, 1fr); }
.ctl { border: 1px solid var(--line-soft); background: var(--white); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.ctl-title { display: block; font-weight: 700; color: var(--brand-dark); font-size: .95rem; }
summary.ctl-title { cursor: pointer; display: list-item; min-height: 28px; }
.ctl-now { font-weight: 400; color: var(--ink); margin-left: .6em; font-size: .9rem; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; align-items: center; }
.ctl-row select { flex: 1 1 130px; min-width: 0; }
.ctl-row #sel-layer { flex: 3 1 180px; }
/* 地図に出すもの（3つのうち1つ） */
.seg { display: inline-flex; flex: 0 1 auto; max-width: 100%; border: 1px solid var(--brand); border-radius: 8px; overflow: hidden; background: var(--white); }
.seg button { flex: 1 1 auto; font: inherit; font-size: .88rem; min-height: 40px; padding: 4px 12px; border: 0; background: var(--white); color: var(--brand-dark); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--brand); }
.seg button:hover { background: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--white); font-weight: 700; }
.seg button[aria-pressed="true"]::before { content: "✓"; content: "✓" / ""; margin-right: 3px; }
.seg button:focus-visible { outline-offset: -4px; outline-color: var(--ink); }
.ctl-row #sel-variant { flex: 1 1 90px; }
.searchbox { position: relative; flex: 1 1 100%; min-width: 0; }
#find { width: 100%; }
#find-results { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 1200; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); max-height: 60vh; overflow-y: auto; padding: 4px; min-width: 280px; }
.find-item { display: flex; align-items: flex-start; gap: 6px; width: 100%; padding: 6px 8px; min-height: 44px; background: none; border: 0; border-radius: 6px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.find-item:hover, .find-item:focus { background: var(--soft); }
.find-item b { display: block; font-weight: 600; }
.find-item small { display: block; font-size: .8rem; }
.find-head { margin: 6px 8px 2px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.find-note { margin: 4px 8px; font-size: .84rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 2px 6px 2px 2px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0 2px 0 0; accent-color: var(--brand); }
.check span { white-space: nowrap; }
.shape { flex: none; vertical-align: -3px; }

/* 地図と一覧 */
.layout { display: grid; gap: 12px; padding: 0 16px 20px; grid-template-columns: minmax(0, 1fr); }
.mapwrap { position: relative; }
#map { height: 62vh; min-height: 360px; border: 1px solid var(--line); border-radius: 10px; background: #F4F2EC; }
.map-actions { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; gap: 6px; }
.act { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 4px 10px; background: var(--white); border: 1px solid var(--brand); border-radius: 8px; color: var(--brand-dark); font: inherit; font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.act:hover { background: var(--soft); }
#layer-badge { position: absolute; top: 56px; right: 10px; z-index: 500; max-width: 70%; background: rgba(255, 255, 255, .94); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: .78rem; font-weight: 600; pointer-events: none; }
#legend { font-size: .82rem; line-height: 1.45; background: var(--white); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.lg-title { font-weight: 700; }
.lg-title small { display: block; font-weight: 400; }
.lg-scale { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lg-scale li { display: flex; align-items: center; gap: 5px; }
.lg-scale i { display: inline-block; width: 18px; height: 13px; border: 1px solid #7A6A45; flex: none; background: #fff; }
.lg-scale i b { display: block; width: 100%; height: 100%; opacity: var(--fo, .75); }
.lg-note { margin: 2px 0 6px; color: var(--muted); }
.lg-points { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lg-points span { display: inline-flex; align-items: center; gap: 3px; }
.lg-cl { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 18px; padding: 0 3px; border-radius: 9px; background: #fff; color: var(--ink); font-size: .64rem; font-weight: 700; font-style: normal; border: 1.5px solid var(--muted); }

/* 地図の点 */
.pt { background: none; border: 0; display: flex; align-items: center; justify-content: center; }
.pt svg { filter: drop-shadow(0 0 1px rgba(0, 0, 0, .55)); }
.pt-prov { opacity: .72; }
.cl { display: flex; align-items: center; justify-content: center; border-radius: 13px; background: rgba(255, 255, 255, .95); color: var(--ink); font-weight: 700; font-size: .74rem; border: 2px solid var(--muted); box-sizing: border-box; white-space: nowrap; cursor: pointer; }
.img-ref { margin: 6px 0 0; align-items: flex-start; }
.img-ref span { white-space: normal; min-width: 0; }
.img-ref[hidden] { display: none; }
.pref-tip { font-size: .85rem; }
.leaflet-popup-content { margin: 12px 14px; font-size: .92rem; line-height: 1.55; }
.detail h3 { margin: 0 2px .3em 0; padding-right: 14px; }
.detail p { margin: 0 0 .45em; }
.d-kind { color: var(--muted); }
.d-status { font-weight: 700; color: var(--brand-dark); background: var(--soft); border-radius: 4px; padding: 1px 6px; }
.d-basis { margin: .3em 0; padding-left: 1.1em; font-size: .86rem; }
.d-pos { font-size: .84rem; color: var(--muted); }

/* 地域の概要（PCは地図の上、スマホは地図のすぐ下） */
.mapcol { display: flex; flex-direction: column; gap: 8px; }
#summary { order: 2; background: var(--white); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 12px 8px; }
#summary .sum-head h2 { font-size: 1.12rem; }
.sum-grid { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.sum-block { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-items: baseline; }
.sum-block > * { min-width: 0; }
.sum-block h3 { margin: 2px 0 0; font-size: .78rem; color: var(--muted); font-weight: 700; }
#summary .counts { display: flex; flex-wrap: wrap; gap: 0 10px; margin: 0; font-size: .92rem; }
#summary .counts li { border: 0; padding: 1px 0; gap: 4px; }
#summary .counts li span { flex: none; }
#summary .counts b { font-size: .98rem; }
#summary .sum-head h2 { margin: 0; }
.sum-pos { margin: 0; font-size: .84rem; font-weight: 600; }
.sum-pos small { font-weight: 400; }
#summary .m-sub { line-height: 1.45; }
.m-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.m-line .m-value { font-size: 1.15rem; }
#summary .m-note { margin: 0; }
#summary-more .more-stats { margin: 0 0 4px; }
.side { min-width: 0; }
.sum-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; }
.sum-head h2 { margin: 0; font-size: 1.25rem; }
.sum-acts { display: flex; align-items: center; gap: 10px; }
.link { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; min-height: 32px; }
.btn-x { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--white); font-size: .85rem; min-height: 32px; }
.btn { display: inline-block; padding: 7px 16px; border: 1px solid var(--brand); border-radius: 8px; background: var(--white); color: var(--brand); font: inherit; cursor: pointer; text-decoration: none; }
.counts, .stats { list-style: none; margin: 6px 0; padding: 0; }
.counts li { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.counts li span, .stats li > span { flex: 1; min-width: 0; }
.counts small, .stats small { display: block; font-size: .78rem; }
.counts b, .stats b { font-size: 1.05rem; white-space: nowrap; }
.counts li.off { color: var(--muted); }
.counts li.off b { font-size: .84rem; font-weight: 400; }
.metric { margin: 8px 0 4px; padding: 6px 10px; background: var(--soft); box-shadow: inset 3px 0 0 var(--brand); border-radius: 6px; }
.m-label { font-weight: 600; font-size: .92rem; }
.m-value { font-size: 1.35rem; font-weight: 700; line-height: 1.35; }
.m-value small { font-size: .78rem; font-weight: 400; margin-left: 4px; }
.m-sub { font-size: .82rem; color: var(--muted); }
.m-note { margin: 2px 0; font-size: .82rem; color: var(--muted); }
.m-link { font-size: .84rem; }
.m-empty { margin: 8px 0 4px; font-size: .84rem; color: var(--muted); }
.more-stats { margin-top: 6px; font-size: .9rem; }
.more-stats summary { cursor: pointer; color: var(--brand); min-height: 30px; }
.ms { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.ms-head { display: flex; justify-content: space-between; gap: 10px; }
.ms p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }

/* 画像の保存 */
#img-dialog { width: min(960px, 96vw); max-height: 94vh; overflow-y: auto; border: 0; border-radius: 12px; padding: 14px 16px; color: var(--ink); background: var(--bg); }
#img-dialog::backdrop { background: rgba(0, 0, 0, .55); }
#img-dialog h2 { margin: 0 0 4px; }
#img-preview { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
#img-preview[hidden] { display: none; }
#img-preview.img-portrait { max-width: 440px; margin: 0 auto; }
.seg { display: inline-flex; margin: 2px 0 6px; border: 1px solid var(--brand); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 40px; padding: 4px 16px; border: 0; background: var(--white); color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--brand); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--white); }
.img-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.img-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 6px 0 4px; padding: 0; border: 0; }
.img-kinds legend { padding: 0; margin-bottom: 4px; font-weight: 600; color: var(--brand-dark); }
.img-kinds label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); cursor: pointer; min-height: 44px; }
.img-kinds label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; background: var(--soft); }
.img-kinds label:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.img-kinds input { margin-top: 4px; flex: none; }
.img-kinds span { display: flex; flex-direction: column; min-width: 0; }
.img-kinds small { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.img-saved { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--soft); font-size: .9rem; }
.img-next { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.img-next h3 { margin: 0 0 4px; font-size: 1rem; }
.img-next ol { margin: 4px 0 6px; padding-left: 1.4em; font-size: .9rem; }
.img-next p { margin: 4px 0; }
.img-warn { color: var(--ink); }
.img-x-text { white-space: pre-wrap; font-size: .85rem; color: var(--muted); padding: 6px 8px; border-left: 3px solid var(--line); background: var(--bg); }
@media (max-width: 699px) { .img-kinds { grid-template-columns: 1fr; } }
.btn.primary { background: var(--brand); color: var(--white); font-weight: 600; }
.btn { min-height: 42px; display: inline-flex; align-items: center; }

/* ランキング */
.rk-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 8px 0 10px; }
.rk-field { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; font-size: .86rem; font-weight: 600; color: var(--brand-dark); }
.rk-field select { width: 100%; font-weight: 400; }
#rk-pref-wrap:has(select[hidden]) { display: none; }
.rk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.rk-head h2 { margin: 0; }
.rk-acts { display: flex; flex-wrap: wrap; gap: 6px; }
button.btn-x { font: inherit; font-size: .85rem; cursor: pointer; }
.btn-x:hover { background: var(--soft); }
.rank .rk-no { width: 3em; text-align: right; white-space: nowrap; font-weight: 700; }
.rk-bar { display: block; height: 6px; margin-top: 3px; background: var(--line-soft); border-radius: 3px; }
.rk-bar i { display: block; height: 100%; background: #CC7629; border-radius: 3px; }
.rank small { display: block; font-weight: 400; }
.cmp-table { font-size: .95rem; }
.cmp-table td small, .cmp-group small { display: block; font-weight: 400; font-size: .8rem; line-height: 1.45; color: var(--muted); }
.cmp-table.no-rank small.rk { display: none; }
.cmp-table tbody th[scope="row"] { font-weight: 400; }
.cmp-table thead th { font-size: 1rem; }
.cmp-group th { background: var(--soft); color: var(--brand-dark); padding-top: 8px; }
.cmp-about { font-weight: 400; color: var(--ink); font-size: .84rem; }
.cmp-about summary { cursor: pointer; color: var(--brand); font-size: .84rem; min-height: 32px; display: flex; align-items: center; }
.cmp-about p { margin: 2px 0 6px; line-height: 1.6; }
.cmp-table thead th.num { min-width: 6.5em; }
/* 2県比較の色：1つ目＝青、2つ目＝オレンジ。濃さ4段階（白と混ぜた14%・30%・50%・75%）。文字は本文の色のまま。県名も書くので色だけに頼らない */
.cmp-table td.cmp-ratio { font-weight: 700; color: var(--ink); background: #F3F1EA; }
.cmp-table td.cmp-ratio small { white-space: normal; color: var(--ink); font-size: .8rem; line-height: 1.35; margin-top: 2px; }
.sx.lv1 { background: #E1ECF9 !important; } .sx.lv2 { background: #BFD7F3 !important; } .sx.lv3 { background: #95BCEA !important; } .sx.lv4 { background: #5F9AE0 !important; }
.sy.lv1 { background: #FCEAE3 !important; } .sy.lv2 { background: #F9D2C2 !important; } .sy.lv3 { background: #F5B49A !important; } .sy.lv4 { background: #F08E67 !important; }
#cmp-ha { box-shadow: inset 0 -4px 0 #2A78D6; } #cmp-hb { box-shadow: inset 0 -4px 0 #EB6834; }
.cmp-ref th, .cmp-ref td { background: #FAF8F2; }
.cmp-note td { font-size: .84rem; line-height: 1.6; color: var(--muted); white-space: normal; }
.cmp-tools { align-items: flex-end; }
.cmp-tools .rk-field select { font-size: 1rem; min-height: 40px; }
.cmp-swap { min-height: 40px; align-self: flex-end; }
.cmp-msg { margin: 12px 0; padding: 10px 14px; background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 8px; font-weight: 600; }
.cmp-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; margin: 10px 0 4px; }
.cmp-opt { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; min-height: 32px; cursor: pointer; }
.cmp-opt input { width: 18px; height: 18px; margin: 0; }
.cmp-how { margin: 0 0 8px; }
.cmp-how summary { cursor: pointer; color: var(--brand); min-height: 32px; display: flex; align-items: center; }
.cmp-how p { margin: 2px 0 6px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 0; }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-sw { display: inline-flex; gap: 2px; }
.cmp-sw b { display: block; width: 14px; height: 14px; border-radius: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cmp-table thead th:first-child, .cmp-table tbody th[scope="row"] { min-width: 5.5em; }
.cmp-say { margin: 14px 0; padding: 12px 16px; background: var(--white); border: 1px solid var(--line-soft); border-left: 5px solid var(--accent); border-radius: 8px; }
.cmp-say h2 { font-size: 1.15rem; color: var(--brand-dark); }
.cmp-points { margin: 8px 0 0; padding-left: 1.4em; }
.cmp-points li { margin: 8px 0; line-height: 1.75; }
.cmp-points li b { display: block; color: var(--brand-dark); }
.cmp-say .fine { margin: 8px 0 0; }
@media (max-width: 600px) {
  .cmp-table thead th.num { min-width: 0; }
  .cmp-table th, .cmp-table td { padding-left: 5px; padding-right: 5px; }
  .cmp-tools .rk-field { flex: 1 1 100%; }
  .cmp-swap { align-self: center; }
  .cmp-say { padding: 10px 12px; }
}
/* スマホ：項目名を上の行に、2つの都道府県の数と「何倍？」を下の行に並べる（横にはみ出さない）。表の役割は role で保つ */
@media (max-width: 480px) {
  .cmp-table, .cmp-table thead, .cmp-table tbody { display: block; }
  .cmp-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .cmp-table thead th:first-child { display: none; }
  .cmp-table thead th.num { text-align: center; }
  .cmp-table tbody th[scope="row"] { grid-column: 1 / -1; min-width: 0; padding: 7px 6px 0; border-bottom: 0; font-weight: 700; }
  .cmp-table tr.cmp-group th, .cmp-table tr.cmp-note td { grid-column: 1 / -1; }
  .cmp-table td.cmp-ratio { white-space: normal; }
}

/* 学校一覧 */
.listbox { margin-top: 14px; border-top: 2px solid var(--line-soft); padding-top: 10px; }
.listbox h2 { margin-bottom: 6px; }
.list-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.list-tools input { flex: 2 1 200px; min-width: 0; }
.list-tools select { flex: 1 1 120px; min-width: 0; }
#list-count { margin: 6px 0 2px; }
.schools { list-style: none; margin: 0; padding: 0; }
.schools > li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.sch-name { background: none; border: 0; padding: 2px 0; text-align: left; font: inherit; font-weight: 700; color: var(--brand); text-decoration: underline; cursor: pointer; min-height: 30px; }
.sch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: .84rem; color: var(--muted); }
.tag { background: var(--soft); border-radius: 4px; padding: 0 6px; font-size: .78rem; color: var(--brand-dark); }
.sch-addr { font-size: .9rem; }
.sch-detail { margin-top: 6px; padding: 8px 10px; background: var(--soft); border-radius: 8px; }
.more { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.more summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* 表 */
.tablewrap { overflow-x: auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: .92rem; }
.plain th, .plain td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.plain thead th { background: var(--soft); color: var(--brand-dark); }
.plain .num { text-align: right; white-space: nowrap; }
.plain tr.on td { background: var(--soft); }
.plain .link { min-height: 0; padding: 0; }

/* 説明のページ */
.wrap { max-width: 1120px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 860px; }
.prose h2 { margin-top: 1.3em; }
.lead { font-size: 1.05rem; }
.figs { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.fig { margin: 0; padding: 12px; background: var(--white); border: 1px solid var(--line-soft); border-radius: 10px; }
.fig svg { display: block; width: 100%; max-width: 180px; height: auto; margin: 0 auto 6px; }
.fig figcaption { font-size: .92rem; }
.src { background: var(--white); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.src dl { margin: 0; font-size: .92rem; }
.src dt { font-weight: 700; color: var(--brand-dark); margin-top: 4px; }
.src dd { margin: 0; }

/* スマホ：最初の画面で地図が広く見えるように上部を詰める */
@media (max-width: 899px) {
  body[data-page="index"] .brand { display: none; }
  .site-head { padding: 2px 8px; }
  .site-menu { margin-left: 0; }
  .site-menu a { padding: 3px 8px; font-size: .86rem; }
  .hero { padding: 6px 16px 2px; }
  .hero h1 { font-size: 1.22rem; }
  .hero .sub { font-size: .86rem; line-height: 1.5; }
  .controls { padding: 4px 16px 8px; gap: 6px; }
  .ctl { padding: 4px 10px; }
  .ctl-row { margin-top: 2px; }
  .ctl-region .ctl-title { font-size: .85rem; }
  .ctl-row select { min-height: 40px; padding: 4px 8px; }
  #map { height: 66vh; }
  /* 「地図に出すもの」の見出しは読み上げ用に残し、画面では省いて地図を上げる */
  #view-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #box-view .ctl-row { margin-top: 0; }
}

@media (min-width: 640px) {
  .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sum-block { grid-template-columns: 7.6em minmax(0, 1fr); column-gap: 10px; }
  .sum-block h3 { grid-row: span 3; }
  .sum-grid { gap: 6px; }
  .sum-block + .sum-block { border-top: 1px solid var(--line-soft); padding-top: 4px; }
  .src dl { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 2px 10px; }
  .src dt { margin-top: 0; }
}
@media (min-width: 900px) {
  .hero { padding-top: 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
  .hero h1 { font-size: 1.3rem; }
  .hero .sub { margin: 0; font-size: .92rem; }
  .controls { display: flex; flex-wrap: wrap; padding-bottom: 8px; }
  .ctl-region { flex: 1 1 380px; }
  #box-types { flex: 0 0 auto; }
  #box-view { flex: 1 1 390px; }
  .searchbox { flex: 2 1 150px; }
  #sel-pref, #sel-city { flex: 1 1 92px; }
  .ctl-row select { font-size: .9rem; }
  .act { min-height: 34px; }
  #layer-badge { display: none; }
  .ctl { padding: 4px 10px 6px; }
  .check { min-height: 34px; }
  .checks { flex-wrap: nowrap; }
  .ctl-row select { min-height: 36px; padding: 3px 8px; }
  summary.ctl-title { list-style: none; pointer-events: none; }
  summary.ctl-title::-webkit-details-marker { display: none; }
  .ctl-now { display: none; }
  .layout { grid-template-columns: minmax(0, 1.75fr) minmax(330px, 1fr); align-items: start; }
  .mapcol { height: calc(100vh - 262px); min-height: 560px; }
  #summary { order: 0; flex: none; }
  .mapwrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #map { flex: 1 1 auto; height: auto; min-height: 0; }
  #legend { flex: none; margin-top: 6px; padding: 5px 10px; }
  .lg-title small { display: inline; margin-left: .6em; }
  .side { height: calc(100vh - 262px); min-height: 500px; overflow-y: auto; padding-right: 8px; }
}
@media print {
  .controls, .list-tools, .sum-acts, #more { display: none; }
}
