/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: auto !important;
  overflow: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Hiragino Sans', sans-serif;
}

/* ── Leaflet attribution ── */
.leaflet-control-attribution { color: #9ca3af !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #9ca3af !important; }

/* ── Map labels (shared with TOP) ── */
.area-label {
  display: inline-block;
  background: rgba(255,255,255,0.80);
  border: 1.5px solid #6FBA2C;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s, transform 0.15s;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.area-label:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.28), 0 0 0 1px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.area-name { font-weight: 700; font-size: 13px; color: #111; line-height: 1.3; }
.area-stats { color: #374151; margin-top: 2px; font-weight: 500; }

/* ── SEO static pages (prefecture / city) ───────────────────── */

.page-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.page-main h1 {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  font-weight: 700;
  color: #111;
  margin: 12px 0 8px;
}

.page-lead {
  font-size: 15px;
  color: #444;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}
.breadcrumb a {
  color: #2563eb;
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep { margin: 0 2px; color: #9ca3af; }

/* ── Sections ─────────────────────────────────────────────────── */
.area-section {
  margin-top: 72px;
}

/* ── 査定 CTA（市区町村ページ本文中） ───────────────────────── */
.satei-cta-section {
  margin-top: 36px;
}
.satei-cta {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #c6e8b8;
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
}
.satei-cta-lead {
  font-size: 18px;
  font-weight: 800;
  color: #111;
  line-height: 1.4;
  margin: 0 0 10px;
}
.satei-cta-desc {
  font-size: 14px;
  color: #374151;
  line-height: 1.7;
  margin: 0 0 18px;
}
.satei-cta-desc strong {
  color: #237009;
}
.satei-cta-btn {
  display: inline-block;
  background: #F77C00;
  color: #fff;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 0 #c05a00;
  transition: background 0.2s;
}
.satei-cta-btn:hover {
  background: #d96a00;
  text-decoration: none;
}
.satei-cta-note {
  font-size: 11px;
  color: #9ca3af;
  margin: 10px 0 0;
}
.area-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

/* ── Chip grid ────────────────────────────────────────────────── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.city-chip,
.pref-chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.city-chip {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}
.city-chip:hover { background: #e0e7ff; color: #1d4ed8; }

.pref-chip {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.pref-chip:hover { background: #dbeafe; }

/* ── About page: リスト・定義リスト ────────────────────────── */
.about-list {
  padding-left: 1.4em;
  line-height: 1.8;
  color: #374151;
  font-size: 15px;
}
.about-list li { margin-bottom: 4px; }
.about-list li strong { color: #111; font-weight: 700; }

.about-dl {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 8px 14px;
  font-size: 15px;
  line-height: 1.7;
  color: #374151;
}
.about-dl dt {
  font-weight: 700;
  color: #1f2937;
  padding-top: 2px;
}
.about-dl dd { padding-top: 2px; }
.about-dl a { color: #2563eb; text-decoration: none; }
.about-dl a:hover { text-decoration: underline; }

.about-para {
  font-size: 15px;
  line-height: 1.8;
  color: #374151;
  margin-bottom: 8px;
}
.about-para a { color: #2563eb; text-decoration: none; }
.about-para a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .about-dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .about-dl dt { padding-top: 8px; }
  .about-dl dd { padding-top: 0; padding-bottom: 4px; }
}

/* ── About page: お問い合わせフォーム (Formspree) ─────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 560px;
  margin-top: 12px;
}
.contact-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
  margin-top: 10px;
}
.contact-label:first-child { margin-top: 0; }
.contact-required {
  font-size: 0.75rem;
  color: #e57373;
  font-weight: 500;
  margin-left: 6px;
}
.contact-optional {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
  margin-left: 6px;
}
.contact-input,
.contact-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #f9fafb;
  color: #111;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.contact-input:focus,
.contact-textarea:focus {
  border-color: #068BF1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(6,139,241,0.12);
}
.contact-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}
.contact-submit {
  align-self: flex-start;
  margin-top: 14px;
  padding: 10px 22px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #F9FAFB;
  color: #111;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #d1d5db;
  transition: background 0.15s, box-shadow 0.1s, transform 0.1s;
}
.contact-submit:hover { background: #f3f4f6; }
.contact-submit:active { box-shadow: none; transform: translateY(1px); }
.contact-submit:focus-visible { outline: 3px solid #068BF1; outline-offset: 2px; }
.contact-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 10px;
  line-height: 1.6;
}
.contact-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 14px 18px;
  color: #166534;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-top: 12px;
}

/* ── Header（TOPと同じスタイルを使用） ───────────────────────── */
#hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid #e5e7eb;
  height: 48px;
}
#hdr-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 12px 0 10px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#logo {
  font-size: 13px;
  font-weight: 800;
  color: #111;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 1.2;
}
#logo-sub {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  display: block;
}
#hdr-search {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  margin-left: 10px;
  margin-right: 0;
  min-width: 0;
  border: 1px solid #2F910D;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
#search-input {
  flex: 1;
  padding: 7px 12px;
  border: none;
  font-size: 13px;
  outline: none;
  background: transparent;
  min-width: 0;
}
#search-input:focus { box-shadow: none; }
#search-go {
  padding: 7px 16px;
  border-radius: 0;
  background: #2F910D;
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: none;
  text-shadow: none;
  min-height: 36px;
}
#search-go:active { background: #236e09; box-shadow: none; }
#search-go:focus-visible { outline: 3px solid #068BF1; outline-offset: 2px; }
.pm-type-btn:focus-visible { outline: 2px solid #068BF1; outline-offset: 2px; border-radius: 4px; }
.pm-dist-btn:focus-visible { outline: 2px solid #068BF1; outline-offset: 2px; }
.city-chip:focus-visible, .pref-chip:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }


/* ── Footer ───────────────────────────────────────────────────── */
#site-footer {
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  padding: 20px 16px;
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.7;
}
#site-footer a {
  color: #6b7280;
  text-decoration: none;
}
#site-footer a:hover { text-decoration: underline; color: #374151; }
.footer-links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-main { padding: 16px 12px 48px; }
  #search-go { min-height: 40px; }
}

/* ── 市町村ページ：マップ＆リスト ────────────────────────────── */
.pm-section { margin-top: 24px; }

#pm-map {
  width: 100%;
  height: min(55vh, 500px);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
  background: #f3f4f6;
}

/* 都道府県ページのマップは少し低めに（市区町村チップ一覧をfold内に入れる） */
#pm-map.pm-map-pref { height: min(50vh, 420px); }
@media (max-width: 600px) {
  #pm-map.pm-map-pref { height: 320px; }
}

.pm-loading {
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  padding: 12px 0;
}

/* フィルター */
.pm-filters { margin-bottom: 12px; }

.pm-type-filter {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pm-type-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.85rem; font-weight: 600; color: #374151;
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; user-select: none;
  background: none; border: none; padding: 2px 0;
}
.pm-type-btn::before {
  content: '';
  width: 15px; height: 15px; border-radius: 3px;
  border: 1.5px solid #d1d5db; background: #fff;
  flex-shrink: 0; transition: all 0.15s;
  display: inline-block;
}
.pm-type-btn.active::before {
  content: '✓';
  font-size: 10px; color: #fff;
  text-align: center; line-height: 14px;
}
.pm-type-btn.active[data-type="02"]::before { background: #4C6B3C; border-color: #4C6B3C; }
.pm-type-btn.active[data-type="03"]::before { background: #6680A0; border-color: #6680A0; }
.pm-type-btn.active[data-type="01"]::before { background: #7C4E57; border-color: #7C4E57; }
.pm-type-btn:not(.active) { opacity: 0.45; }

.pm-dist-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pm-dist-btn {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s;
}
.pm-dist-btn.active { background: #e0e7ff; border-color: #818cf8; color: #1d4ed8; }
.pm-dist-btn:hover { background: #f0f0ff; }

/* リスト */
.pm-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
  padding: 6px 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 8px;
}
.pm-count { font-weight: 400; color: #6b7280; font-size: 0.85rem; }

.pm-list { display: flex; flex-direction: column; gap: 6px; max-height: 600px; overflow-y: auto; }

.pm-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f3f4f6;
}

.pm-badge {
  font-size: 0.72rem;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pm-price {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
}

.pm-detail {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.4;
}

.pm-empty { color: #9ca3af; font-size: 0.9rem; text-align: center; padding: 24px 0; }

@media (max-width: 600px) {
  #pm-map { height: 280px; }
  .pm-list { max-height: 480px; }
}

/* ── ライブ統計（API読み込み後に平均・中央値を表示） ──────── */
#pm-live-stats {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
#pm-live-stats:empty { display: none; }

.pm-stat-row {
  display: grid;
  grid-template-columns: 4.5em 2.5em 1fr 1fr;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}
.pm-stat-row:last-child { margin-bottom: 0; }

.pm-stat-type {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pm-stat-n {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}

.pm-stat-avg,
.pm-stat-med {
  font-size: 12px;
  color: #111;
  white-space: nowrap;
}
.pm-stat-med { padding-left: 12px; }

.pm-stat-note {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 8px;
  cursor: help;
  display: block;
  text-align: right;
  border-bottom: 1px dashed #d1d5db;
  width: fit-content;
  margin-left: auto;
  position: relative;
}
.pm-stat-note:hover { color: #6b7280; }
.pm-stat-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #1f2937;
  color: #f9fafb;
  font-size: 12px;
  line-height: 1.7;
  padding: 12px 16px;
  border-radius: 8px;
  width: 300px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 100;
  white-space: normal;
  text-align: left;
}
.pm-stat-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 16px;
  border: 6px solid transparent;
  border-top-color: #1f2937;
}
.pm-stat-tooltip.show { display: block; }
.pm-stat-tooltip dt { font-weight: 700; color: #fbbf24; margin-bottom: 2px; }
.pm-stat-tooltip dd { margin-bottom: 8px; }
.pm-stat-tooltip dd:last-child { margin-bottom: 0; }

.pm-stat-nodata-msg {
  font-size: 0.78rem;
  color: #9ca3af;
}

.pm-stat-nodata { opacity: 0.6; }
