/* === Site-wide design tokens (from manabi-palette shared) === */
:root,
[data-theme="light"] {
  --bg-primary: #FAF8F3;
  --bg-secondary: #F5F1E8;
  --bg-card: #F7F3EA;
  --bg-elevated: #FFFFFF;
  --border-subtle: rgba(107, 94, 75, 0.10);
  --border-medium: rgba(107, 94, 75, 0.18);
  --text-primary: #3D3428;
  --text-secondary: #6B5E4B;
  --text-tertiary: #9A8D7A;
  --text-on-accent: #FFFFFF;
  --accent: #B8943E;
  --accent-hover: #A6842E;
  --accent-soft: rgba(184, 148, 62, 0.12);
  --accent-glow: rgba(184, 148, 62, 0.25);
  --shadow-sm: 0 1px 3px rgba(60, 50, 30, 0.06);
  --shadow-md: 0 4px 16px rgba(60, 50, 30, 0.08);
  --shadow-lg: 0 8px 32px rgba(60, 50, 30, 0.10);
  --nav-bg: rgba(245, 241, 232, 0.88);
  --grain-opacity: 0.03;
  --mode-icon: "\1F319";
  --mode-label: "\30C0\30FC\30AF";
  /* --- map rendering tokens (light) --- */
  --muni-stroke: #5B4F3B;          /* 市区町村の境界線: ライトははっきり濃く */
  --muni-stroke-width: 0.7;
  --pref-outline: #2E271C;         /* 都道府県外周: ライトはほぼ黒 */
  --pref-outline-width: 2.2;
  --hatch-bg: #ECE4D4;             /* 未確認の下地: 背景(#FAF8F3)より一段濃く区別 */
  --hatch-line: #B39F7F;           /* 未確認の斜線 */
  --label-halo: rgba(250, 248, 243, 0.95); /* ラベルの縁取り(可読性) */
  --sel-fill: #FF7A1A;             /* 選択中マスの塗り(目立つオレンジ) */
  --sel-stroke: #A63E00;           /* 選択中マスの枠線 */
  --label-unconfirmed: #6E5F45;    /* 未確認ラベルの文字色(やや濃く) */
}
[data-theme="dark"] {
  --bg-primary: #1C1A16;
  --bg-secondary: #242118;
  --bg-card: #2A2720;
  --bg-elevated: #322E26;
  --border-subtle: rgba(200, 185, 150, 0.08);
  --border-medium: rgba(200, 185, 150, 0.14);
  --text-primary: #E8E2D6;
  --text-secondary: #B8AE9C;
  --text-tertiary: #7A7264;
  --text-on-accent: #1C1A16;
  --accent: #D4A84A;
  --accent-hover: #E0B85A;
  --accent-soft: rgba(212, 168, 74, 0.14);
  --accent-glow: rgba(212, 168, 74, 0.20);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(36, 33, 24, 0.92);
  --grain-opacity: 0.04;
  --mode-icon: "\2600\FE0F";
  --mode-label: "\30E9\30A4\30C8";
  /* --- map rendering tokens (dark) --- */
  --muni-stroke: rgba(232, 226, 214, 0.28); /* 境界線: ダークは控えめな明色 */
  --muni-stroke-width: 0.7;
  --pref-outline: rgba(232, 226, 214, 0.75); /* 都道府県外周: ダークは明色ではっきり */
  --pref-outline-width: 2.2;
  --hatch-bg: #2A2720;             /* 未確認の下地: ダークで白浮きしない */
  --hatch-line: #4E483B;           /* 未確認の斜線 */
  --label-halo: rgba(20, 18, 14, 0.9); /* ラベル縁取り(暗) */
  --sel-fill: #FF8C33;             /* 選択中マスの塗り(ダーク用オレンジ) */
  --sel-stroke: #FFD9B0;           /* 選択中マスの枠線(明) */
  --label-unconfirmed: #9A8E78;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* === NAV (shared pattern) === */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 0 clamp(16px, 4vw, 48px);
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.logo {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 1.15rem; font-weight: 800; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--text-on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; letter-spacing: -0.5px;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.nav-links {
  display: flex; align-items: center; gap: 28px;
}
.nav-links a {
  font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
  text-decoration: none;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.nav-highlight { color: var(--accent); font-weight: 700; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border-medium); background: var(--bg-card);
  cursor: pointer; font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle::before { content: var(--mode-icon); font-size: 0.9rem; }
.theme-toggle::after { content: var(--mode-label); }
.mobile-menu-btn {
  display: none; background: none; border: none;
  cursor: pointer; width: 32px; height: 32px; position: relative;
}
.mobile-menu-btn span,
.mobile-menu-btn span::before,
.mobile-menu-btn span::after {
  display: block; width: 20px; height: 2px;
  background: var(--text-secondary); border-radius: 1px;
  transition: all 0.3s ease; position: absolute; left: 6px;
}
.mobile-menu-btn span { top: 15px; }
.mobile-menu-btn span::before { content: ''; top: -6px; }
.mobile-menu-btn span::after { content: ''; top: 6px; }
.mobile-only-link { display: none; }
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 999;
}
.mobile-overlay.active { display: block; }

/* Breadcrumb */
.breadcrumb {
  padding: 80px clamp(16px,4vw,48px) 0;
  max-width: 1120px; margin: 0 auto;
}
.breadcrumb ol {
  display: flex; gap: 8px; list-style: none;
  font-size: 0.8rem; color: var(--text-tertiary);
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb li + li::before { content: '>'; margin-right: 8px; }

/* === FOOTER (shared pattern) === */
.footer {
  background: var(--bg-secondary); padding: 48px clamp(20px,5vw,48px) 24px;
  border-top: 1px solid var(--border-subtle); margin-top: 64px;
}
.footer-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; gap: 48px; flex-wrap: wrap;
}
.footer-brand { flex: 1 1 240px; }
.footer-brand p { font-size: 0.82rem; color: var(--text-tertiary); margin-top: 10px; }
.footer-links { flex: 0 1 180px; }
.footer-links h4 { font-size: 0.78rem; color: var(--text-tertiary); margin-bottom: 12px; }
.footer-links a {
  display: block; font-size: 0.82rem; color: var(--text-secondary);
  text-decoration: none; margin-bottom: 8px;
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1120px; margin: 24px auto 0;
  padding-top: 16px; border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-tertiary); text-align: center;
}

/* === FEEMAP page-scoped styles === */
.feemap-main {
  max-width: 1120px; margin: 0 auto;
  padding: 24px clamp(16px,4vw,48px) 0;
}
.feemap-header {
  margin-bottom: 24px;
}
.feemap-header h1 {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700; margin-bottom: 12px;
}
.feemap-lead {
  font-size: 0.92rem; color: var(--text-secondary);
  line-height: 1.8; margin-bottom: 16px;
}
.feemap-warning-bar {
  background: #FFF3CD; border: 1px solid #FFEAA7;
  border-radius: 8px; padding: 12px 16px;
  font-size: 0.85rem; line-height: 1.7;
  color: #856404; margin-bottom: 24px;
}
[data-theme="dark"] .feemap-warning-bar {
  background: rgba(255,193,7,0.12); border-color: rgba(255,193,7,0.25);
  color: #FFD93D;
}
.feemap-warning-bar strong { font-weight: 700; }

/* Layer tabs */
.feemap-tabs {
  display: flex; gap: 0; margin-bottom: 16px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border-medium);
}
.feemap-tab {
  flex: 1; padding: 10px 8px; text-align: center;
  font-size: 0.82rem; font-weight: 600;
  background: var(--bg-card); color: var(--text-secondary);
  border: none; cursor: pointer;
  border-right: 1px solid var(--border-medium);
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.2s, color 0.2s;
}
.feemap-tab:last-child { border-right: none; }
.feemap-tab[aria-selected="true"] {
  background: var(--accent); color: var(--text-on-accent);
}
.feemap-tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px;
}

/* Legend */
.feemap-legend {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 20px;
}
.feemap-legend-title {
  font-size: 0.78rem; font-weight: 700; margin-bottom: 8px;
  color: var(--text-secondary);
}
.feemap-legend-items {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
}
.feemap-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-secondary);
}
.feemap-legend-swatch {
  width: 20px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.feemap-legend-group-label {
  width: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.feemap-legend-group-label:first-child {
  margin-top: 0;
}
.feemap-legend-note {
  font-size: 0.75rem; color: var(--text-tertiary);
  margin-top: 8px; line-height: 1.6;
}
.feemap-legend-note strong { font-weight: 700; }

/* Map container */
.feemap-map-wrap {
  display: flex; gap: 0; margin-bottom: 24px;
  position: relative;
}
.feemap-map-container {
  flex: 1; min-width: 0;
}
.feemap-map-container svg {
  width: 100%; height: auto;
  max-height: 70vh;
  touch-action: pan-y; /* 通常時はページ縦スクロールを許可（拡大時はJSでnoneに切替） */
}
/* 概要ボックス：インライン指定の明色を上書きし、ライト/ダーク両対応に */
.feemap-summary {
  background: var(--accent-soft) !important;
  border-left-color: var(--accent) !important;
  color: var(--text-secondary);
}
.feemap-summary p { color: var(--text-secondary); }
.feemap-summary strong { color: var(--text-primary); }
.feemap-error {
  text-align: center; padding: 60px 20px;
  font-size: 1rem; color: var(--text-secondary);
  background: var(--bg-card); border-radius: 12px;
  border: 1px solid var(--border-subtle);
}
.feemap-error button {
  margin-top: 12px; padding: 10px 24px;
  background: var(--accent); color: var(--text-on-accent);
  border: none; border-radius: 20px; cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif; font-size: 0.88rem;
}

/* SVG municipality paths */
.feemap-muni {
  stroke: var(--muni-stroke); stroke-width: var(--muni-stroke-width);
  cursor: pointer; transition: opacity 0.15s, stroke-width 0.15s;
  pointer-events: all; /* 塗り(ハッチ/透明部含む)の面全体をクリック可能に。未指定だと線しか当たらない */
}
.feemap-muni:hover {
  opacity: 0.85; stroke-width: 1.4; stroke: var(--accent);
}
/* クリック時の四角い選択枠(outline矩形)は出さない。選択は形に沿った枠線で示す */
.feemap-muni:focus { outline: none; }
.feemap-muni:focus-visible {
  outline: none; stroke: var(--accent); stroke-width: 2;
}
.feemap-muni[aria-pressed="true"] {
  fill: var(--sel-fill);                 /* 選択中は塗りを目立つ色に(今どこを選択中か一目で分かる) */
  stroke: var(--sel-stroke); stroke-width: 2.4;
}
/* 都道府県の外周アウトライン: 太線でストロークしたクローンを塗りの背面に敷き、
   内側の線は上の塗りに隠れ、外周だけがはみ出して輪郭になる(ステッカー輪郭法) */
.feemap-outline-layer .feemap-pref-outline-seg {
  fill: none; stroke: var(--pref-outline);
  stroke-width: var(--pref-outline-width);
  stroke-linejoin: round; stroke-linecap: round;
  pointer-events: none;
}

/* Theme-aware hatch pattern override (未確認) — CSSはpresentation属性に勝つ */
#hatch-unknown rect { fill: var(--hatch-bg); }
#hatch-unknown line { stroke: var(--hatch-line); }

/* SVG label text */
.feemap-label {
  fill: var(--text-primary);
  pointer-events: none; font-family: 'Noto Sans JP', sans-serif;
  text-anchor: middle; dominant-baseline: central;
  font-weight: 700;
  paint-order: stroke;                 /* 縁取りを文字の下に */
  stroke: var(--label-halo);
  stroke-width: 0.14em;                /* フォントサイズ比例の細いハロー(字が潰れない) */
  stroke-linejoin: round;
}
/* 白文字ラベルは濃いハローで縁取り、青地・オレンジ地でもはっきり見えるように */
.feemap-label-light { fill: #fff; stroke: rgba(0, 0, 0, 0.6); }
.feemap-label-unconfirmed {
  fill: var(--label-unconfirmed); font-weight: 500;
}

/* Hatch pattern for unknown */
.feemap-hatch-rect {
  fill: url(#hatch-unknown);
}

/* 離島inset(東京の島嶼部)の枠は fill:none でも枠内全体をクリック可能にする
   (デフォルトだと枠線しか反応せず、島の外をクリックすると無反応になるバグ対策) */
.feemap-inset .feemap-inset-box,
.feemap-inset rect {
  pointer-events: all;
  cursor: pointer;
}
.feemap-inset .feemap-muni { cursor: pointer; }

/* Agency cards */
.feemap-org-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.feemap-org-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 20px; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feemap-org-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.feemap-org-card:focus-visible {
  outline: 2px solid var(--accent);
}
.feemap-org-card-name {
  font-size: 0.92rem; font-weight: 700; margin-bottom: 6px;
}
.feemap-org-card-detail {
  font-size: 0.82rem; color: var(--text-secondary);
}
.feemap-requester-badge {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  background: #FF4B00; color: #fff;
  font-size: 0.72rem; font-weight: 700; margin-bottom: 8px;
}

/* Detail panel - bottom sheet on mobile, side panel on tablet+ */
.feemap-panel-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 2000;
}
.feemap-panel-overlay.feemap-panel-open { display: block; }

.feemap-panel {
  position: fixed; z-index: 2001;
  background: var(--bg-elevated);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  /* Mobile: bottom sheet */
  bottom: 0; left: 0; right: 0;
  max-height: 80vh; border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding: 0;
  display: none;
}
.feemap-panel.feemap-panel-open {
  display: block; transform: translateY(0);
}
.feemap-panel-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--text-tertiary); opacity: 0.4;
  margin: 10px auto; display: block;
}
.feemap-panel-content {
  padding: 4px 20px 24px;
}
.feemap-panel-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--text-tertiary);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.feemap-panel-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

.feemap-panel-name {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 4px; padding-right: 36px;
}
.feemap-panel-badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.feemap-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 600;
}
.feemap-badge-feetype {
  background: var(--accent-soft); color: var(--accent);
}
.feemap-badge-transparency-A { background: rgba(0,90,255,0.12); color: #005AFF; }
.feemap-badge-transparency-B { background: rgba(246,170,0,0.12); color: #C48500; }
.feemap-badge-transparency-C { background: rgba(200,200,203,0.2); color: #666; }

.feemap-panel-section {
  margin-bottom: 16px;
}
.feemap-panel-section-title {
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}
.feemap-panel-row {
  display: flex; gap: 8px; margin-bottom: 4px;
  font-size: 0.85rem; line-height: 1.7;
}
.feemap-panel-label {
  flex-shrink: 0; font-weight: 600;
  color: var(--text-secondary); min-width: 80px;
}
.feemap-panel-value {
  color: var(--text-primary);
}
.feemap-panel-value a {
  color: var(--accent); text-decoration: underline;
}
.feemap-panel-note {
  font-size: 0.78rem; color: var(--text-tertiary);
  line-height: 1.6; margin-top: 4px;
}
.feemap-unconfirmed-box {
  background: #FFF3CD; border: 1px solid #FFEAA7;
  border-radius: 8px; padding: 16px; text-align: center;
  margin-bottom: 16px;
}
[data-theme="dark"] .feemap-unconfirmed-box {
  background: rgba(255,193,7,0.1); border-color: rgba(255,193,7,0.2);
}
.feemap-unconfirmed-box strong {
  font-size: 1.05rem; display: block; margin-bottom: 8px;
}
.feemap-submit-btn {
  display: inline-block; margin-top: 10px;
  padding: 10px 20px; border-radius: 24px;
  background: var(--accent); color: var(--text-on-accent) !important;
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
  border: none; cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}
.feemap-submit-btn:hover { background: var(--accent-hover); }

/* Tier table */
.feemap-tier-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.82rem; margin-top: 8px;
}
.feemap-tier-table th, .feemap-tier-table td {
  padding: 6px 10px; text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.feemap-tier-table th {
  font-weight: 600; color: var(--text-secondary);
  background: var(--bg-secondary);
}

/* 2018 section distinct styling */
.feemap-2018-section {
  background: var(--bg-secondary); border-radius: 8px;
  padding: 12px 14px; margin-top: 12px;
  border-left: 3px solid #84919E;
}
.feemap-2018-label {
  font-size: 0.72rem; font-weight: 700;
  color: #84919E; margin-bottom: 4px;
}

/* Source section */
.feemap-sources {
  background: var(--bg-secondary); border-radius: 12px;
  padding: 24px; margin-top: 32px;
  border: 1px solid var(--border-subtle);
}
.feemap-sources h2 {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.1rem; font-weight: 700; margin-bottom: 12px;
}
.feemap-sources p, .feemap-sources li {
  font-size: 0.85rem; color: var(--text-secondary);
  line-height: 1.8;
}
.feemap-sources ul {
  margin: 8px 0; padding-left: 20px;
}
.feemap-sources a { color: var(--accent); }

/* Municipality tile grid (always visible) */
.feemap-muni-tiles {
  margin-top: 20px; margin-bottom: 24px;
}
.feemap-muni-tiles-heading {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1rem; font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.feemap-muni-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
/* 一覧の折りたたみ + 表示切替ツールバー */
.feemap-muni-tiles-heading {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.feemap-muni-tiles-heading .toggle-arrow {
  font-size: 0.7rem; color: var(--text-tertiary);
  transition: transform 0.2s;
}
.feemap-muni-tiles.feemap-collapsed .toggle-arrow { transform: rotate(-90deg); }
.feemap-muni-tiles-count {
  font-size: 0.78rem; font-weight: 400; color: var(--text-tertiary);
}
.feemap-muni-tiles.feemap-collapsed .feemap-tiles-body { display: none; }
.feemap-tiles-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: 12px;
}
.feemap-tiles-toolbar .feemap-sort-label { margin-right: 2px; }
.feemap-tiles-region-head {
  font-size: 0.82rem; font-weight: 700; color: var(--text-secondary);
  margin: 14px 0 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: baseline; gap: 8px;
}
.feemap-tiles-region-head:first-child { margin-top: 0; }
.feemap-tiles-region-head .feemap-tiles-region-count {
  font-size: 0.72rem; font-weight: 400; color: var(--text-tertiary);
}
.feemap-tiles-region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
.feemap-muni-tile-rank {
  font-size: 0.66rem; font-weight: 700; color: var(--text-on-accent);
  background: var(--accent); border-radius: 8px;
  padding: 0 6px; margin-bottom: 2px;
}
@media (max-width: 374px) {
  .feemap-tiles-region-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
.feemap-muni-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 6px; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 6px; cursor: pointer;
  text-decoration: none; color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
  min-height: 52px;
}
.feemap-muni-tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.feemap-muni-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.feemap-muni-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.feemap-muni-tile-name {
  font-size: 0.82rem; font-weight: 600; line-height: 1.3;
}
.feemap-muni-tile-fee {
  font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px;
}
.feemap-muni-tile-fee.unconfirmed {
  color: var(--text-tertiary); font-style: italic;
}
@media (max-width: 374px) {
  .feemap-muni-tiles-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Municipality ranking list (collapsible) */
.feemap-muni-list {
  margin-top: 16px;
}
.feemap-muni-list summary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; color: var(--text-secondary);
  padding: 10px 18px;
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-card); border: 1px solid var(--border-medium);
  border-radius: 24px; transition: all 0.15s;
  list-style: none;
}
.feemap-muni-list summary::-webkit-details-marker { display: none; }
.feemap-muni-list summary::marker { display: none; content: ''; }
.feemap-muni-list summary:hover { border-color: var(--accent); color: var(--accent); }
.feemap-muni-list summary .toggle-arrow { transition: transform 0.2s; }
.feemap-muni-list[open] summary .toggle-arrow { transform: rotate(180deg); }
.feemap-sort-controls {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 12px; align-items: center;
}
.feemap-sort-label {
  font-size: 0.78rem; color: var(--text-tertiary); font-weight: 600;
  margin-right: 2px;
}
.feemap-sort-btn {
  padding: 5px 12px; font-size: 0.75rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border-medium);
  border-radius: 16px; cursor: pointer; color: var(--text-secondary);
  font-family: 'Noto Sans JP', sans-serif; transition: all 0.15s;
  white-space: nowrap;
}
.feemap-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
.feemap-sort-btn[aria-pressed="true"] {
  background: var(--accent); color: var(--text-on-accent);
  border-color: var(--accent);
}
.feemap-sort-btn[aria-pressed="true"]::after {
  margin-left: 3px;
}
.feemap-sort-btn[data-dir="asc"][aria-pressed="true"]::after { content: ' \2191'; }
.feemap-sort-btn[data-dir="desc"][aria-pressed="true"]::after { content: ' \2193'; }
/* Mobile sort select */
.feemap-sort-select {
  display: none; width: 100%; padding: 8px 12px;
  font-size: 0.82rem; border: 1px solid var(--border-medium);
  border-radius: 8px; background: var(--bg-card); color: var(--text-primary);
  font-family: 'Noto Sans JP', sans-serif; margin-bottom: 10px;
}
/* Ranking table (>=768px) */
.feemap-ranking-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.feemap-ranking-table th {
  padding: 8px 10px; text-align: left; font-weight: 600;
  color: var(--text-secondary); background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-medium);
  white-space: nowrap; font-size: 0.75rem;
}
.feemap-ranking-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.feemap-ranking-row {
  cursor: pointer; transition: background 0.12s;
}
.feemap-ranking-row:hover { background: var(--accent-soft); }
.feemap-ranking-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.feemap-ranking-rank {
  font-weight: 700; color: var(--text-tertiary); min-width: 32px; text-align: center;
}
.feemap-ranking-name { font-weight: 600; }
.feemap-ranking-fee { font-weight: 700; }
.feemap-ranking-fee-note {
  font-size: 0.7rem; color: var(--text-tertiary); font-weight: 400;
}
.feemap-ranking-unconfirmed {
  color: var(--text-tertiary); font-style: italic;
}
.feemap-ranking-badge {
  display: inline-block; padding: 1px 8px; border-radius: 3px;
  font-size: 0.7rem; font-weight: 700; text-align: center; min-width: 24px;
}
.feemap-ranking-badge-A { background: rgba(0,90,255,0.12); color: #005AFF; }
.feemap-ranking-badge-B { background: rgba(246,170,0,0.12); color: #C48500; }
.feemap-ranking-badge-C { background: rgba(200,200,203,0.2); color: #888; }
.feemap-ranking-change-raised { color: #03AF7A; font-weight: 600; }
.feemap-ranking-change-unchanged { color: #FF4B00; font-weight: 600; }
.feemap-ranking-note {
  font-size: 0.75rem; color: var(--text-tertiary); margin-top: 8px; line-height: 1.6;
}
/* Mobile card list (for <768px) */
.feemap-ranking-cards {
  display: none;
}
.feemap-ranking-card {
  padding: 10px 12px; font-size: 0.82rem;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 8px; cursor: pointer; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.feemap-ranking-card:hover { border-color: var(--accent); }
.feemap-ranking-card:focus-visible { outline: 2px solid var(--accent); }
.feemap-ranking-card-rank {
  font-weight: 700; color: var(--text-tertiary); min-width: 28px;
  text-align: center; font-size: 0.78rem;
}
.feemap-ranking-card-body {
  flex: 1; min-width: 0;
}
.feemap-ranking-card-name { font-weight: 600; font-size: 0.85rem; }
.feemap-ranking-card-vals {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px;
}
@media (max-width: 767px) {
  .feemap-sort-controls { display: none; }
  .feemap-sort-select { display: block; }
  .feemap-ranking-table { display: none; }
  .feemap-ranking-cards { display: block; }
}
@media (min-width: 768px) {
  .feemap-ranking-cards { display: none; }
  .feemap-ranking-table { display: table; }
}

/* Responsive */
@media (min-width: 768px) {
  .feemap-panel {
    /* Tablet+: side panel */
    top: 64px; right: 0; bottom: 0; left: auto;
    width: 420px; max-height: none;
    border-radius: 0; transform: translateX(100%);
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  }
  .feemap-panel.feemap-panel-open {
    transform: translateX(0);
  }
  .feemap-panel-handle { display: none; }
  /* ドロワーを開いたら本文(地図+一覧+ランキング)全体をドロワー幅ぶん寄せて重なりを防ぐ */
  body { transition: padding-right 0.3s ease; }
  body.feemap-drawer-open { padding-right: 420px; }
  .feemap-map-wrap {
    margin-right: 0;
    transition: margin-right 0.3s;
  }
  .feemap-map-wrap.feemap-panel-active {
    margin-right: 0;
  }
}
@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--bg-primary); padding: 24px;
    gap: 16px; z-index: 1001;
  }
  .mobile-menu-btn { display: block; }
  .mobile-only-link { display: block !important; }
  .feemap-tabs { flex-direction: column; }
  .feemap-tab { border-right: none; border-bottom: 1px solid var(--border-medium); }
  .feemap-tab:last-child { border-bottom: none; }
  .footer-inner { flex-direction: column; gap: 24px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .feemap-panel { transition: none; }
  .feemap-muni { transition: none; }
  .feemap-tooltip { transition: none; }
}

/* ===== 02: Desktop overlay removal (地図クリック直接切替) ===== */
@media (min-width: 768px) {
  .feemap-panel-overlay { display: none !important; }
}

/* ===== 02b: Hover tooltip (PC only) ===== */
.feemap-tooltip {
  position: fixed; pointer-events: none;
  z-index: 3000; padding: 5px 10px;
  background: var(--bg-elevated); border: 1px solid var(--border-medium);
  border-radius: 6px; box-shadow: var(--shadow-md);
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-primary); white-space: nowrap;
  opacity: 0; transition: opacity 0.15s;
  display: none;
}
.feemap-tooltip.visible { opacity: 1; }
@media (hover: hover) { .feemap-tooltip { display: block; } }

/* ===== 02b: Prefecture label ===== */
/* 地図と文字が被らないよう半透明チップで浮かせる */
.feemap-pref-label {
  position: absolute; top: 8px; left: 8px; z-index: 10;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.95rem; font-weight: 700;
  color: var(--text-primary);
  pointer-events: none;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px; padding: 5px 14px;
  box-shadow: var(--shadow-sm);
  max-width: calc(100% - 16px);
}
.feemap-pref-label small {
  font-size: 0.72rem; font-weight: 400;
  color: var(--text-secondary); margin-left: 6px;
}
/* スクロールしたらナビ直下に固定(移動して固定)。どのページでもワンタップで全国に戻れる */
.feemap-pref-label.feemap-preflabel-stuck {
  position: fixed;
  top: 70px;
  left: clamp(16px, 4vw, 48px);
  z-index: 900;
}
/* チップ自体はクリックを地図に通す。ただし「日本地図」リンクだけは押せるようにする */
.feemap-pref-label a.feemap-preflabel-home {
  pointer-events: auto; cursor: pointer;
  color: var(--accent); font-weight: 700; text-decoration: none;
}
.feemap-pref-label a.feemap-preflabel-home:hover { text-decoration: underline; }
.feemap-preflabel-sep { margin: 0 6px; color: var(--text-tertiary); }

/* ===== zoom / pan controls (JSで注入) ===== */
.feemap-map-container { position: relative; }
.feemap-zoom-controls {
  position: absolute; right: 10px; bottom: 10px; z-index: 12;
  display: flex; flex-direction: column; gap: 6px;
}
.feemap-zoom-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-medium); cursor: pointer;
  font-size: 1.25rem; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
.feemap-zoom-btn:hover { border-color: var(--accent); color: var(--accent); }
.feemap-zoom-btn:active { background: var(--accent-soft); }
.feemap-zoom-btn:disabled { opacity: 0.4; cursor: default; }
.feemap-zoom-btn.feemap-zoom-reset { font-size: 1rem; }
.feemap-zoom-hint {
  position: absolute; left: 8px; bottom: 10px; z-index: 11;
  font-size: 0.7rem; color: var(--text-tertiary);
  background: var(--nav-bg); border-radius: 12px; padding: 3px 10px;
  border: 1px solid var(--border-subtle);
  pointer-events: none; opacity: 0.9;
}
.feemap-map-container.feemap-zoomed .feemap-svg-viewport { cursor: grab; }
.feemap-map-container.feemap-panning .feemap-svg-viewport { cursor: grabbing; }
@media (max-width: 767px) {
  .feemap-zoom-hint { display: none; }
  .feemap-zoom-btn { width: 44px; height: 44px; }
}

/* ===== 02b: Sidebar (right column) ===== */
.feemap-sidebar {
  display: none;
}
.feemap-summary-title {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.1rem; font-weight: 700; margin-bottom: 16px;
}
.feemap-summary-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.feemap-summary-stat-label { color: var(--text-secondary); }
.feemap-summary-stat-value { font-weight: 600; }
.feemap-summary-breakdown {
  display: flex; gap: 8px; margin-top: 4px; margin-bottom: 12px;
}
.feemap-summary-breakdown .feemap-badge { font-size: 0.72rem; }
.feemap-summary-guide {
  margin-top: 16px; padding: 14px;
  background: var(--bg-secondary); border-radius: 8px;
  font-size: 0.82rem; color: var(--text-secondary);
  text-align: center; line-height: 1.7;
}
.feemap-sidebar .feemap-panel-close {
  position: absolute; top: 8px; right: 8px;
}

/* ===== 02: submission_status badge ===== */
.feemap-badge-submission {
  background: rgba(255,152,0,0.12); color: #E68A00;
}

/* ===== 02b: ≥1024px — fixed drawer (same as 768–1023) ===== */
@media (min-width: 1024px) {
  .feemap-map-wrap {
    display: flex; gap: 0; position: relative;
    margin-right: 0 !important;
    transition: none !important;
  }
  .feemap-map-wrap.feemap-panel-active {
    margin-right: 0 !important;
  }
  .feemap-map-container { flex: 1; min-width: 0; position: relative; }
  .feemap-sidebar { display: none; }
  .feemap-panel-overlay { display: none !important; }
}

/* ===== 02b: 768–1023px slide-over (no layout shift) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .feemap-map-wrap,
  .feemap-map-wrap.feemap-panel-active {
    margin-right: 0 !important;
    transition: none !important;
  }
  .feemap-panel-overlay { display: none !important; }
}

/* ===== v1.2.0: blank_area_note + special_note ===== */
.feemap-blank-area-note {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-left: 3px solid #C8C8CB;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-line;
  border-radius: 0 6px 6px 0;
}
.feemap-special-note {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: #FFF4E6;
  border-left: 3px solid #F6AA00;
  font-size: 0.82rem;
  color: #7A4100;
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
}
[data-theme="dark"] .feemap-blank-area-note {
  background: rgba(200,200,203,0.08);
  border-left-color: #7A7264;
}
[data-theme="dark"] .feemap-special-note {
  background: rgba(246,170,0,0.1);
  border-left-color: #D4A84A;
  color: #FFD93D;
}

/* ===== SNS share bar ===== */
.feemap-share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}
.feemap-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 44px;
}
.feemap-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.feemap-share-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.feemap-share-btn svg { flex-shrink: 0; }
.feemap-share-x:hover { color: #000; border-color: #000; }
[data-theme="dark"] .feemap-share-x:hover { color: #fff; border-color: #fff; }
.feemap-share-line:hover { color: #06C755; border-color: #06C755; }
.feemap-share-fb:hover { color: #1877F2; border-color: #1877F2; }
.feemap-share-copy:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 広告(AdSense) — 承認後に pref-map.js の ADS 枠IDを設定すると表示 ===== */
.feemap-ad-label {
  display: block; font-size: 11px; color: #9aa3ad;
  letter-spacing: .08em; text-align: center; margin-bottom: 4px;
}
/* PC左余白の縦長レール。中央1120pxコンテンツに被らないワイド画面のみ表示 */
.feemap-ad-rail {
  position: fixed; top: 50%; left: 16px; transform: translateY(-50%);
  width: 160px; z-index: 20; display: none;
}
@media (min-width: 1500px) { .feemap-ad-rail { display: block; } }
/* 詳細パネル下部の広告 */
.feemap-ad-panel {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(128,128,128,0.18); text-align: center;
}
.feemap-ad-panel ins { margin: 0 auto; }
