/* 明るい表示だけ（端末のダーク設定には合わせない。印刷も同じ配色） */
:root {
  --fg: #212529;
  --muted: #5c636a;
  --line: #dee2e6;
  --bg: #ffffff;
  --bg-sub: #f8f9fa;
  --accent: #d6336c;      /* 台数が分かる店の円と同じ色 */
  --unknown: #868e96;     /* 台数不明の店の円と同じ色 */
  --panel-w: 340px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--fg);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

.site-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.site-header h1 { margin: 0; font-size: 1.15rem; }
.unofficial {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: normal;
  vertical-align: middle;
}
.summary { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.summary strong { color: var(--fg); }

.layout { flex: 1; display: flex; min-height: 0; }

.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }

.panel {
  width: var(--panel-w);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg);
}
.panel-actions { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-actions button {
  font: inherit;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-sub);
  cursor: pointer;
}
.panel-actions button:hover { border-color: var(--muted); }

/* 店舗の一覧 */
.store-list h2 {
  margin: 0;
  padding: 6px 12px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.store-list ul { list-style: none; margin: 0; padding: 0; }
.store-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.store-item:hover { background: var(--bg-sub); }
.store-item[aria-current="true"] { background: #fff0f6; box-shadow: inset 3px 0 0 var(--accent); }
.store-item .name { flex: 1; }
/* 地図の位置が未登録の店（押せない） */
.store-item.unplaced { cursor: default; }
.store-item.unplaced:hover { background: var(--bg); }
.unplaced-note { display: block; color: var(--muted); font-size: 0.75rem; }
.badge {
  min-width: 2.2em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
}
.badge.unknown { background: var(--unknown); }

.notes { padding: 4px 12px 16px; font-size: 0.82rem; color: var(--muted); }
.notes h2 { font-size: 0.9rem; margin: 12px 0 4px; color: var(--fg); }
.notes ul { margin: 0; padding-left: 1.2em; }
.notes li { margin: 4px 0; }

/* 凡例 */
.legend {
  position: absolute;
  left: 10px;
  bottom: 28px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  pointer-events: none;
}
.legend .title { font-weight: bold; margin-bottom: 4px; }
.legend .row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.legend .swatch { display: inline-flex; justify-content: center; align-items: center; flex: none; }
.legend .dot { border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }

/* 店舗の詳細（地図の吹き出し）
   deck.gl の描画面は MapLibre の操作ボタンの入れ物（z-index: 2）の中に置かれるので、吹き出しをそれより手前に出す */
.maplibregl-popup { z-index: 3; }
.maplibregl-popup-content { padding: 10px 12px; min-width: 220px; font-size: 0.88rem; }
.popup h3 { margin: 0 18px 2px 0; font-size: 1rem; }
.popup .pref { margin: 0 0 6px; color: var(--muted); font-size: 0.8rem; }
.popup dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 6px; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; }
.popup .loc { margin: 6px 0 0; color: var(--muted); font-size: 0.75rem; }

/* 狭い画面（スマートフォン）: 地図を上、一覧を下に */
@media (max-width: 760px) {
  body { height: auto; }
  .layout { flex-direction: column; }
  .map-wrap { flex: none; height: 62vh; }
  .panel { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  /* 凡例は横 1 列にして、地図を隠す面積を減らす */
  .legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 10px;
    left: 6px;
    bottom: 22px;
    max-width: calc(100% - 12px);
    padding: 3px 8px;
  }
  .legend .title { width: 100%; margin: 0; }
  .legend .row { margin: 0; gap: 3px; }
  .legend .swatch { width: auto !important; }
}

@media print {
  .panel-actions { display: none; }
}
