:root {
  --ink: #22252b;
  --ink-sub: #5c6270;
  --paper: #f4f2ed;
  --panel: #ffffff;
  --line: #d9d5cc;
  --navy: #1f2733;
  --navy-deep: #161d27;
  --accent: #8a6d3b;      /* 灯りを思わせる落ち着いた金茶 */
  --accent-soft: #f3ead8;
  --marker: #37414f;
  --danger: #9c3d3d;
  --radius: 6px;
  --header-h: 58px;
  --banner-h: 34px;
  --sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

body {
  display: flex;
  flex-direction: column;
}

/* ---------- ヘッダー ---------- */
.site-header {
  height: var(--header-h);
  background: var(--navy);
  color: #f0ede6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex: 0 0 auto;
  border-bottom: 3px solid var(--accent);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--accent);
  flex: 0 0 auto;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
}

.tagline {
  margin: 2px 0 0;
  font-size: 11px;
  color: #b8bdc6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav { display: flex; gap: 8px; flex: 0 0 auto; }

.nav-btn {
  background: transparent;
  border: 1px solid #4a5568;
  color: #dfe3ea;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}
.nav-btn:hover { border-color: var(--accent); color: #fff; }
.nav-btn--mobile { display: none; }

/* ---------- サンプル注意バナー ---------- */
.sample-banner {
  flex: 0 0 auto;
  min-height: var(--banner-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px;
  background: #fbf3e2;
  color: #7a5a1e;
  border-bottom: 1px solid #e5d5ae;
  font-size: 12px;
  text-align: center;
}

/* ---------- 本体レイアウト ---------- */
.app-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 360px;
  flex: 0 0 auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-controls {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #faf9f6;
}

.search-box {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
}
.search-box:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.filter-row { display: flex; gap: 8px; margin-top: 8px; }

.filter-row select {
  flex: 1 1 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  background: #fff;
  color: var(--ink);
}

.result-count {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-sub);
}

/* ---------- 事案リスト ---------- */
.case-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.case-item {
  padding: 12px 14px;
  border-bottom: 1px solid #eceae4;
  cursor: pointer;
}
.case-item:hover { background: var(--accent-soft); }
.case-item.is-active { background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 11px; }

.case-item .case-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.case-item .case-meta {
  margin: 0;
  font-size: 12px;
  color: var(--ink-sub);
  line-height: 1.5;
}

.case-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 3px;
  background: #eef0f3;
  color: #444c59;
  margin-right: 6px;
}

.case-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--ink-sub);
  text-align: center;
}

/* ---------- 解決済み実績バー・一覧 ---------- */
.resolved-bar {
  flex: 0 0 auto;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-top: 1px solid var(--line);
  background: #f0f4ef;
  color: #3d5a40;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.resolved-bar:hover { background: #e3ece2; }
.resolved-bar strong { font-size: 15px; margin: 0 2px; }
.resolved-bar-arrow { float: right; color: #6d8a70; }

.resolved-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.resolved-list li {
  padding: 10px 4px;
  border-bottom: 1px solid #eceae4;
}
.resolved-item-title { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.resolved-item-meta { margin: 0; font-size: 12px; color: #3d5a40; }

.tip-contact {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d8c9a5;
  font-size: 12px;
}
.tip-contact a { color: var(--accent); }

/* ---------- 地図 ---------- */
.map-wrap { flex: 1 1 auto; min-width: 0; position: relative; }
#map { position: absolute; inset: 0; background: #dfe6ea; }

.lantern-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 4px;
  background: var(--marker);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  color: #f0d9a8;
  font-family: var(--serif);
  font-size: 15px;
  transform: rotate(-45deg);
}
.lantern-marker span { transform: rotate(45deg); }

/* クラスタは件数で段階色: 〜9件=紺 / 10〜99件=金茶 / 100件〜=臙脂 */
.marker-cluster-small { background-color: rgba(55, 65, 79, .35); }
.marker-cluster-small div {
  background-color: rgba(31, 39, 51, .85);
}
.marker-cluster-medium { background-color: rgba(138, 109, 59, .35); }
.marker-cluster-medium div {
  background-color: rgba(122, 94, 46, .9);
}
.marker-cluster-large { background-color: rgba(122, 59, 59, .4); }
.marker-cluster-large div {
  background-color: rgba(105, 45, 45, .92);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  color: #f0ede6;
  font-family: var(--sans);
  font-weight: 600;
}

/* 地図上の件数バッジ(モバイルでも常時見える) */
.map-count {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 900;
  pointer-events: none;
  background: rgba(31, 39, 51, .88);
  color: #f0ede6;
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.map-count strong {
  color: var(--accent-light, #c9a35c);
  font-size: 15px;
  margin-right: 2px;
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  border-top: 3px solid var(--accent);
}
.leaflet-popup-content { margin: 12px 14px; font-family: var(--sans); }

.popup-title { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; }
.popup-meta { margin: 0 0 8px; font-size: 12px; color: var(--ink-sub); line-height: 1.6; }
.popup-link {
  display: inline-block;
  font-size: 12px;
  color: #fff;
  background: var(--navy);
  padding: 5px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.popup-link:hover { background: var(--navy-deep); }

/* ---------- モーダル ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}
.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  background: var(--panel);
  border-radius: 8px;
  max-width: 640px;
  width: 100%;
  max-height: min(84vh, 760px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  border-top: 4px solid var(--accent);
}

.modal-close {
  position: sticky;
  top: 8px;
  float: right;
  margin: 8px 8px 0 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #edeae3;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  z-index: 1;
}
.modal-close:hover { background: var(--line); }

.modal-body { padding: 20px 26px 26px; }

.detail-kicker {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--accent);
  margin: 0 0 4px;
}

.detail-title {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 4px;
  line-height: 1.4;
}

.detail-sub { font-size: 12.5px; color: var(--ink-sub); margin: 0 0 16px; }

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.detail-table th,
.detail-table td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}
.detail-table th {
  width: 8.5em;
  background: #f6f4ef;
  font-weight: 600;
  white-space: nowrap;
}

.detail-table a { color: var(--accent); }
.source-fetched { font-size: 11px; color: var(--ink-sub); }

.detail-contact {
  background: var(--accent-soft);
  border: 1px solid #e2d3b3;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.8;
}
.detail-contact strong { display: block; margin-bottom: 2px; }

.detail-note { font-size: 11.5px; color: var(--ink-sub); margin: 14px 0 0; line-height: 1.7; }

/* about モーダル */
.about-body h2 { font-family: var(--serif); margin: 4px 0 14px; font-size: 20px; }
.about-body h3 {
  font-size: 14.5px;
  margin: 18px 0 6px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}
.about-body p, .about-body li { font-size: 13.5px; line-height: 1.9; }
.about-body ul { padding-left: 20px; margin: 6px 0; }
.about-note { color: var(--danger); }

/* ---------- 支援リンク ---------- */
.donation-links { display: flex; gap: 8px; flex-wrap: wrap; }

.donation-btn {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.donation-btn:hover { background: var(--accent); color: #fff; }

.footer-link {
  background: none;
  border: none;
  padding: 0;
  color: #c9cfd8;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}
.footer-link:hover { color: #fff; }

/* ---------- フッター ---------- */
.site-footer {
  flex: 0 0 auto;
  background: var(--navy-deep);
  color: #9aa1ab;
  font-size: 11px;
  text-align: center;
  padding: 8px 16px;
}
.site-footer p { margin: 0; }

/* ---------- モバイル ---------- */
@media (max-width: 768px) {
  .tagline { display: none; }
  .nav-btn--mobile { display: inline-block; }

  .brand-text { min-width: 0; overflow: hidden; }
  .brand-text h1 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-btn { padding: 6px 10px; font-size: 12px; white-space: nowrap; }

  .app-body { position: relative; }

  .sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 1500;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.is-open { transform: translateX(0); }

  .modal-body { padding: 16px; }
  .detail-table th { width: 6.5em; }
}
