/* 統合トップ用スタイル */

.index-main { padding-top: 18px; }

/* 日の丸（左上） */
.page-header .container { position: relative; padding-left: 64px; }
.jp-flag-corner {
  position: absolute;
  top: 0;
  left: 0;
  line-height: 0;
}
.jp-flag-corner svg {
  display: block;
  width: 48px;
  height: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  border-radius: 1px;
}
@media (max-width: 700px) {
  .page-header .container { padding-left: 44px; }
  .jp-flag-corner svg { width: 32px; height: 21px; }
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  padding: 14px 16px;
}
.stat-card.accent { border-color: #c8324c; border-width: 1.5px; background: #fff5f7; }
.stat-card .label { font-size: 12px; color: #6b7785; font-weight: 600; }
.stat-card .value { font-size: 24px; font-weight: 700; color: #1f3658; margin-top: 4px; }
.stat-card.accent .value { color: #c8324c; }
.stat-card .sub { font-size: 12px; color: #6b7785; margin-top: 2px; }

/* 統計の種別タグ（推計 / 住基）— 別統計の混同防止 */
.metric-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.metric-tag.tag-est { background: #fde8c8; color: #92520e; }
.metric-tag.tag-juki { background: #d6e7f3; color: #1f6f9a; }

/* ヒーロー直下の出典注記 */
.hero-source-note {
  font-size: 11.5px;
  line-height: 1.6;
  color: #4b5564;
  background: #fafbfc;
  border: 1px solid #e6ecf2;
  border-left: 3px solid #c8324c;
  border-radius: 4px;
  padding: 7px 11px;
  margin: -6px 0 20px;
}
.hero-source-note strong { color: #1f3658; }

/* 自治体一覧パネルの注記 */
.panel-note { font-size: 11.5px; color: #6b7785; margin: 0 0 8px; line-height: 1.5; }
.panel-note strong { color: #2a4a7f; }

@media (max-width: 800px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

.index-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1000px) {
  .index-grid { grid-template-columns: 1fr; }
}

.map-wrap {
  background: #fff;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  padding: 8px;
  position: relative;
}
#japan-map {
  width: 100%;
  height: 540px;
  border-radius: 4px;
  background: #eef2f6;
  position: relative;
}
#map-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.7);
  color: #2a4a7f;
  font-weight: 600;
  font-size: 13px;
  z-index: 500;
}
#map-notice {
  position: absolute;
  left: 12px; right: 12px; top: 12px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12.5px;
  z-index: 510;
  display: none;
}
.map-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.map-controls.top { padding: 4px 6px 8px; border-bottom: 1px solid #e6ecf2; margin-bottom: 6px; }
.map-controls label { font-weight: 600; color: #2a4a7f; }
.map-controls select { padding: 5px 8px; border: 1px solid #c4cfd9; border-radius: 4px; font-size: 12.5px; min-width: 180px; }
.map-controls .hint { font-size: 11.5px; color: #6b7785; margin-left: 4px; }
.map-mode-note { font-size: 11.5px; color: #334155; background: #f1f5f9; border-left: 3px solid #64748b; border-radius: 4px; padding: 6px 10px; margin: 0 6px 6px; }
.map-mode-note[hidden] { display: none; }
.map-legend {
  margin-top: 6px;
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid #e6ecf2;
  border-radius: 4px;
  font-size: 12px;
}
.map-legend .legend-title { font-weight: 700; color: #2a4a7f; margin-bottom: 4px; }
.map-legend .legend-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; }
.map-legend .legend-cell { flex: 1; }
.map-legend .legend-scale { display: flex; justify-content: space-between; margin-top: 2px; color: #6b7785; font-size: 11px; }
.map-legend .legend-source { margin-top: 4px; color: #6b7785; font-size: 11px; }
.map-legend .legend-extra { margin-top: 5px; font-size: 11.5px; color: #4b5564; display:flex; align-items:center; gap:6px; }
.map-legend .legend-swatch-mini { display:inline-block; width:14px; height:10px; }
.map-popup-detail .popup-hidden-note { background:#fef3c7; color:#92400e; padding:5px 8px; border-radius:3px; font-size:11.5px; margin:4px 0 8px; }

.muni-list-panel {
  background: #fff;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  padding: 14px 16px;
  max-height: 600px;
  overflow-y: auto;
}
.muni-list-panel h3 { font-size: 14px; margin: 0 0 10px; color: #2a4a7f; }
.search-row { display: flex; gap: 6px; margin-bottom: 10px; }
.search-row input { flex: 1; padding: 6px 8px; border: 1px solid #c4cfd9; border-radius: 4px; font-size: 13px; }
.search-row select { padding: 6px 8px; border: 1px solid #c4cfd9; border-radius: 4px; font-size: 12px; }
.muni-list { display: grid; gap: 4px; }
.muni-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: #fafbfc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
  border-left: 3px solid transparent;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.muni-row:hover { background: #f0f4f8; border-left-color: #c8324c; }
.muni-row.selected { background: #fffbeb; border: 1px solid #fcd34d; border-left-width: 4px; box-shadow: 0 0 0 1px #fcd34d; }
.muni-row .pref-tag {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #e6ecf2;
  color: #4b5764;
  font-weight: 600;
}
.map-popup-detail .popup-src { display: block; font-size: 10.5px; color: #8a94a3; font-weight: 400; }
.muni-row .muni-name { font-weight: 600; color: #1a2330; }
.muni-row .meta {
  text-align: right;
  font-size: 12px;
  color: #6b7785;
  line-height: 1.3;
}
.muni-row .meta .count { font-weight: 700; color: #c8324c; }
.muni-row.supported { border-left-color: #c8324c; }
.muni-row .cho-chip {
  display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 700;
  padding: 1px 5px; border-radius: 3px; background: #fde2e8; color: #9f1239; vertical-align: middle;
}
.list-note { font-size: 11px; color: #6b7785; padding: 4px 2px 6px; line-height: 1.5; }
.list-note strong { color: #2a4a7f; }

.info-list { padding-left: 22px; }
.info-list li { margin: 4px 0; line-height: 1.6; }

.map-popup-detail h4 { margin: 0 0 6px; font-size: 14px; color: #1f3658; }
.map-popup-detail dl { display: grid; grid-template-columns: 80px 1fr; gap: 3px 8px; margin: 0 0 8px; font-size: 12.5px; }
.map-popup-detail dt { color: #6b7785; }
.map-popup-detail dd { margin: 0; font-weight: 600; }
.map-popup-detail .open-btn {
  display: inline-block;
  padding: 5px 12px;
  background: #c8324c;
  color: #fff;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.map-popup-detail .open-btn:hover { background: #9f1239; }
.map-popup-detail .popup-tier { margin: 6px 0 8px; }

/* ランキングセクション */
.ranking-section { margin-top: 28px; }
.ranking-section .caption { font-size: 12.5px; color: #6b7785; margin: 4px 0 12px; }
.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ranking-grid.two-col { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .ranking-grid, .ranking-grid.two-col { grid-template-columns: 1fr; } }
.ranking-card {
  background: #fff; border: 1px solid #d5dde6; border-radius: 6px;
  padding: 14px 16px 12px;
}
.ranking-card h3 { font-size: 13.5px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e6ecf2; color: #2a4a7f; }
.rk-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
}
.rk-row:hover { background: #f0f4f8; }
.rk-num { color: #6b7785; font-weight: 700; font-size: 11px; }
.rk-name { font-weight: 600; }
.rk-muni-tag { font-size: 10.5px; background: #e6ecf2; color: #4b5764; padding: 1px 5px; border-radius: 3px; margin-right: 4px; }
.rk-value { color: #c8324c; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.rk-date { color: #6b7785; font-size: 10.5px; white-space: nowrap; margin-left: 6px; }

.badge-latest { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.badge-ref { background: #e0e7ff; color: #3730a3; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }

.tier-grid { display: grid; gap: 10px; }
.tier-card { background: #fff; border: 1px solid #d5dde6; border-radius: 6px; padding: 12px 16px; }
.tier-card.tier-a { border-left: 4px solid #166534; }
.tier-card.tier-b { border-left: 4px solid #3730a3; }
.tier-card.tier-c { border-left: 4px solid #6b7785; }
.tier-card h3 { font-size: 14px; margin: 0 0 8px; color: #1f3658; }
.tier-muni-list { margin: 4px 0 6px; padding-left: 18px; columns: 2; column-gap: 24px; }
.tier-muni-list li { font-size: 12.5px; line-height: 1.6; break-inside: avoid; }
.tier-muni-list a { color: #1f6f9a; text-decoration: none; }
.tier-muni-list a:hover { text-decoration: underline; }
.muted { color: #6b7785; }
.muted.small { font-size: 11.5px; }

@media (max-width: 700px) {
  #japan-map { height: 360px; }
  .map-controls.top { flex-direction: column; align-items: flex-start; }
  .map-controls.top select { width: 100%; }
  .map-controls .hint { margin-left: 0; }
  .rk-row { grid-template-columns: 24px 1fr auto; }
  .rk-row .rk-date { grid-column: 2 / span 2; font-size: 10px; }
  .tier-muni-list { columns: 1; }
}
