/* =========================================================
   新サイト 記録の一覧と地図
   - parts.css の後に読み込む。クラス名は lm-
   ========================================================= */

/* ---------- 一覧の頭 ---------- */
.lm-head { background: var(--cmt-surface); padding: 16px 16px 12px; border-bottom: 1px solid var(--cmt-line); }
.lm-head h1 { margin: 0; font-size: var(--cmt-fs-xxl); color: var(--cmt-navy); line-height: 1.3; }
.lm-head p { margin: 4px 0 0; font-size: 13px; color: var(--cmt-text-sub); }
.lm-themes { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.lm-themes::-webkit-scrollbar { display: none; }
.lm-themes a {
  flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; text-decoration: none;
  font-size: 13px; font-weight: 700; border: 1px solid var(--cmt-line); border-left: 4px solid var(--cmt-region); background: var(--cmt-white);
}
.lm-themes a.car { border-left-color: var(--cmt-car); }
.lm-themes a.bike { border-left-color: var(--cmt-bike); }
.lm-themes small { font-size: 12px; color: var(--cmt-text-sub); font-weight: 500; }

.lm-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; font-size: 12px; color: var(--cmt-text-sub); }
.lm-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 16px 8px; }
.lm-filter-btn { padding: 0 14px !important; font-size: 14px !important; white-space: nowrap; }
.lm-filter-btn b { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--cmt-navy); color: #fff; font-size: 12px; margin-left: 4px; }
.lm-more { display: block; margin: 16px; }

/* ---------- 下から出る窓（絞り込み） ---------- */
.lm-sheet-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(22,32,43,.45); }
.lm-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 85; max-height: 86vh; overflow-y: auto;
  background: var(--cmt-white); border-radius: 12px 12px 0 0; box-shadow: 0 -4px 20px rgba(22,32,43,.2);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}
.lm-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #C9D1DA; margin: 0 auto 8px; }
.lm-sheet-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 17px; }
.lm-field { padding: 12px 0; border-bottom: 1px solid var(--cmt-line); }
.lm-field > p { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--cmt-text-sub); }
.lm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lm-chips button {
  min-height: 40px; padding: 0 14px; border: 1px solid #B9C1CB; background: #fff; border-radius: var(--cmt-r-pill);
  font: inherit; font-size: 14px; font-weight: 700; color: var(--cmt-text); cursor: pointer; position: relative;
}
.lm-chips button::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
.lm-chips button[aria-pressed="true"] { background: var(--cmt-navy); border-color: var(--cmt-navy); color: #fff; }
.lm-input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #B9C1CB; border-radius: var(--cmt-r-btn); font: inherit; font-size: 16px; }
.lm-sheet-foot { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding-top: 12px; }

/* ---------- トップ（MAP） ---------- */
.lm-mapbox { position: relative; background: #E9EEF2; overflow: hidden; border-bottom: 1px solid var(--cmt-line); }
.lm-mapbox svg.lm-map { display: block; width: 100%; height: 310px; }
.lm-mapbox[data-expanded="true"] svg.lm-map { height: 62vh; min-height: 380px; }
.lm-map-range { position: absolute; left: 8px; bottom: 8px; background: rgba(255,255,255,.92); font-size: 12px; padding: 2px 8px; color: var(--cmt-text-sub); }
.lm-pin { cursor: pointer; }
.lm-pin circle.hit { fill: transparent; }
.lm-pin text { font-size: 12px; font-weight: 700; fill: #fff; pointer-events: none; font-family: var(--cmt-font); }
.lm-pin[aria-pressed="true"] circle.face { fill: var(--cmt-accent); }

/* 地図の右横の格納式メニュー */
.lm-tray { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; background: rgba(255,255,255,.96); border: 1px solid var(--cmt-line); padding: 4px; }
.lm-tray button {
  width: 50px; height: 44px; border: 0; background: transparent; color: var(--cmt-navy); cursor: pointer; border-radius: var(--cmt-r-btn);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: inherit; font-size: 10px; font-weight: 700; line-height: 1.1; gap: 2px; white-space: nowrap; letter-spacing: -.04em; padding: 0;
}
.lm-tray button:hover { background: var(--cmt-surface); }
.lm-tray svg { width: 18px; height: 18px; }
.lm-tray[data-open="false"] .lm-tray-item { display: none; }
.lm-tray-pull { /* 畳んだときのつまみ */
  position: absolute; top: 8px; right: 0; min-height: 44px; padding: 0 8px; border: 1px solid var(--cmt-line); border-right: 0;
  background: rgba(255,255,255,.96); font: inherit; font-size: 12px; font-weight: 700; color: var(--cmt-navy); cursor: pointer;
}

/* 地図で選んだピンの 1 行カード */
.lm-pick { border-bottom: 1px solid var(--cmt-line); background: var(--cmt-white); }
.lm-pick .cmt-row { border-bottom: 0; }
.lm-pick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 12px; }

/* いまの状況 */
.lm-now { padding: 14px 16px 12px; border-bottom: 1px solid var(--cmt-line); }
.lm-now-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lm-now-head h2 { margin: 0; font-size: 17px; }
.lm-now-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.lm-now-row > span { font-size: 12px; color: var(--cmt-text-sub); font-weight: 700; }
.lm-chart-title { margin: 12px 0 2px; font-size: 13px; font-weight: 700; }
.lm-chart-wrap { overflow-x: auto; position: relative; }
.lm-chart { display: block; }
.lm-chart .bar { fill: var(--cmt-car); }
.lm-chart[data-kind="bike"] .bar { fill: var(--cmt-bike); }
.lm-chart .bar:hover, .lm-chart .bar:focus { fill: var(--cmt-navy); outline: none; }
.lm-chart .axis { font-size: 10px; fill: var(--cmt-text-sub); font-family: var(--cmt-font-mono); }
.lm-chart .grid { stroke: var(--cmt-line); stroke-width: 1; }
.lm-tip { position: absolute; pointer-events: none; background: var(--cmt-text); color: #fff; font-size: 12px; padding: 4px 8px; white-space: nowrap; transform: translate(-50%, -110%); }
.lm-reg { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--cmt-line); }
.lm-reg small { display: block; font-size: 12px; color: var(--cmt-text-sub); }
.lm-reg .cmt-num { font-size: 26px; font-weight: 700; color: var(--cmt-text); }
.lm-reg .unit { font-size: 13px; font-weight: 700; }

/* タイムライン */
.lm-day { margin: 0; padding: 10px 16px 4px; font-size: 13px; font-weight: 700; color: var(--cmt-text-sub); background: var(--cmt-white); }
.lm-reports { display: flex; gap: 10px; overflow-x: auto; padding: 4px 16px 12px; scrollbar-width: none; }
.lm-reports::-webkit-scrollbar { display: none; }
.lm-report { flex: 0 0 72%; max-width: 260px; text-decoration: none; border: 1px solid var(--cmt-line); }
.lm-report-img { height: 92px; background: linear-gradient(160deg, #46586B, #0D2B45); position: relative; }
.lm-report-img span { position: absolute; left: 8px; top: 8px; background: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; }
.lm-report b { display: block; padding: 8px 10px 0; font-size: 15px; line-height: 1.45; }
.lm-report small { display: block; padding: 2px 10px 10px; font-size: 12px; color: var(--cmt-text-sub); }

/* スマホを横にしたとき: 左に地図・右に小窓とタイムライン */
@media (orientation: landscape) and (max-height: 520px) {
  .lm-top { display: grid; grid-template-columns: 1fr 1fr; height: calc(100vh - var(--cmt-header-h)); }
  .lm-top-left { position: relative; }
  .lm-top-left .lm-mapbox, .lm-top-left .lm-mapbox svg.lm-map { height: 100%; }
  .lm-top-right { overflow-y: auto; border-left: 1px solid var(--cmt-line); }
}
@media (min-width: 900px) {
  .lm-top { display: grid; grid-template-columns: 3fr 2fr; height: calc(100vh - var(--cmt-header-h)); }
  .lm-top-left .lm-mapbox, .lm-top-left .lm-mapbox svg.lm-map { height: 100%; }
  .lm-top-right { overflow-y: auto; border-left: 1px solid var(--cmt-line); }
  .lm-wrap { max-width: 760px; margin: 0 auto; }
}

/* 広めるボタン（一覧のカードの下） */
.lm-share { display: flex; justify-content: flex-end; padding: 0 16px 12px; background: var(--cmt-white); }
.lm-share-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--cmt-line); background: var(--cmt-white); color: var(--cmt-navy); font: inherit; font-size: 13px; font-weight: 700; border-radius: var(--cmt-r-btn); cursor: pointer; }

/* 読み込み中・空・もっと見る */
.lm-empty { padding: 24px 16px; font-size: 15px; color: var(--cmt-text-sub); line-height: 1.7; }
.lm-note { margin: 0; padding: 6px 16px; font-size: 12px; color: var(--cmt-text-sub); line-height: 1.6; }
.lm-sample { background: var(--cmt-surface); border-bottom: 1px solid var(--cmt-line); padding: 8px 16px; font-size: 12px; color: var(--cmt-text-sub); line-height: 1.6; }
button.lm-more { width: calc(100% - 32px); }

/* 地図の枠（差し替え用の枠。中身は地図の部品が描く） */
.lm-map-slot { width: 100%; height: 310px; background: #E9EEF2; }
.lm-mapbox[data-expanded="true"] .lm-map-slot { height: 62vh; min-height: 380px; }
.lm-plain { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.lm-plain .land { fill: #E4EDF3; stroke: #D3DAE1; stroke-width: 1; vector-effect: non-scaling-stroke; }
.lm-plain .japan { fill: #FAFBFC; stroke: #AEBBC7; stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.lm-plain .pin { cursor: pointer; }
.lm-plain .pin .face { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.lm-plain .pin--car .face { fill: var(--cmt-car); }
.lm-plain .pin--bike .face { fill: var(--cmt-bike); }
.lm-plain .pin--buyer .face { fill: var(--cmt-buyer); }
.lm-plain .pin--found .face { fill: var(--cmt-found); } /* 凡例の「見つかった」と同じ色 */
.lm-plain .pin[aria-pressed="true"] .face { fill: var(--cmt-accent); }
.lm-plain .pin .hit { fill: transparent; }
.lm-plain .pin text { font-size: 11px; font-weight: 700; fill: #fff; pointer-events: none; text-anchor: middle; }
.lm-map-plainnote { position: absolute; left: 8px; top: 8px; max-width: 60%; background: rgba(255,255,255,.92); font-size: 11px; padding: 2px 8px; color: var(--cmt-text-sub); line-height: 1.5; }

/* ---------- ヒートマップ（警察の公開データ。色は件数の分布に合わせて 5 段階・薄い黄から濃い赤へ。明るさの順で読める） ---------- */
:root {
  --lm-heat-1: #FFF2A8; --lm-heat-2: #FEC44F; --lm-heat-3: #F4802E; --lm-heat-4: #D7301F; --lm-heat-5: #7F0000; --lm-heat-line: #6A6A6A;
}
.lm-heat-top { position: absolute; left: 0; right: 56px; top: 0; padding: 6px 10px; background: rgba(255,255,255,.94); font-size: 12px; line-height: 1.5; color: var(--cmt-text); border-bottom: 1px solid var(--cmt-line); }
.lm-heat-top b { font-weight: 700; }
.lm-legend { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px 8px; background: rgba(255,255,255,.95); border-top: 1px solid var(--cmt-line); font-size: 12px; color: var(--cmt-text); }
.lm-legend-title { margin: 0 0 4px; font-size: 12px; font-weight: 700; }
.lm-legend-title span { font-weight: 400; color: var(--cmt-text-sub); }
.lm-legend ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.lm-legend li { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 11px; line-height: 1.3; color: var(--cmt-text); }
.lm-legend i { display: block; height: 14px; border: 1px solid var(--lm-heat-line); }
.lm-legend li[data-c="0"] i { background: #fff; }
.lm-legend li[data-c="1"] i { background: var(--lm-heat-1); }
.lm-legend li[data-c="2"] i { background: var(--lm-heat-2); }
.lm-legend li[data-c="3"] i { background: var(--lm-heat-3); }
.lm-legend li[data-c="4"] i { background: var(--lm-heat-4); }
.lm-legend li[data-c="5"] i { background: var(--lm-heat-5); }
.lm-legend li[data-c="n"] i { background: repeating-linear-gradient(135deg, #fff 0 3px, #8A94A0 3px 4px); }
.lm-mapbox[data-heat="true"] .lm-map-range, .lm-mapbox[data-heat="true"] .lm-map-plainnote { display: none; }
.lm-plain .heat { cursor: pointer; }
.lm-plain .heat .face { stroke: var(--lm-heat-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lm-plain .heat[data-c="0"] .face { fill: #fff; }
.lm-plain .heat[data-c="1"] .face { fill: var(--lm-heat-1); }
.lm-plain .heat[data-c="2"] .face { fill: var(--lm-heat-2); }
.lm-plain .heat[data-c="3"] .face { fill: var(--lm-heat-3); }
.lm-plain .heat[data-c="4"] .face { fill: var(--lm-heat-4); }
.lm-plain .heat[data-c="5"] .face { fill: var(--lm-heat-5); }
.lm-plain .heat text { font-size: 9.5px; font-weight: 700; text-anchor: middle; pointer-events: none; fill: var(--cmt-text); }
.lm-plain .heat[data-c="4"] text, .lm-plain .heat[data-c="5"] text { fill: #fff; }
.lm-plain .heat[aria-pressed="true"] .face { stroke: var(--cmt-navy); stroke-width: 3.5; }
.lm-plain .heat .flag { fill: #B3260B; pointer-events: none; }
.lm-heat { padding: 10px 16px 14px; background: var(--cmt-white); border-bottom: 1px solid var(--cmt-line); }
.lm-heat-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.lm-heat-row > span { font-size: 12px; font-weight: 700; color: var(--cmt-text-sub); min-width: 3em; }
.lm-heat-pick { margin: 4px 0 8px; padding: 10px 12px; background: var(--cmt-surface); border-left: 4px solid var(--lm-heat-4); font-size: 15px; line-height: 1.6; }
.lm-heat-pick b { font-size: 17px; }
.lm-heat-h { margin: 12px 0 4px; font-size: 15px; }
.lm-heat-rank { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--cmt-line); }
.lm-heat-rank li { border-bottom: 1px solid var(--cmt-line); }
.lm-heat-rank button { display: grid; grid-template-columns: 1.6em 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-size: 15px; text-align: left; cursor: pointer; color: var(--cmt-text); }
.lm-heat-rank .n { font-family: var(--cmt-font-num); font-weight: 700; color: var(--cmt-text-sub); }
.lm-heat-rank .v { font-weight: 700; }
.lm-heat-note { margin: 8px 0 0; font-size: 12px; line-height: 1.7; color: var(--cmt-text-sub); }

/* ヒートマップを開いたとき: 題と凡例は地図の絵に重ねず、地図の枠の上下に置く（絵の上に載せると北や南の地域が隠れるため） */
.lm-mapbox[data-heat="true"] .lm-heat-top { position: static; padding-right: 64px; }
.lm-mapbox[data-heat="true"] .lm-legend { position: static; }
.lm-mapbox[data-heat="true"] .lm-map-slot { height: 400px; }
.lm-mapbox[data-heat="true"][data-expanded="true"] .lm-map-slot { height: 62vh; min-height: 460px; }
.lm-top-left:has(.lm-mapbox[data-heat="true"]) .lm-note { display: none; }
.lm-mapbox[data-heat="true"] .lm-tray, .lm-mapbox[data-heat="true"] .lm-tray-pull { top: 40px; }
.lm-legend li[data-c="x"] i { background: #D5D9DE; }
.lm-plain .heat[data-c="x"] .face { fill: #D5D9DE; stroke-dasharray: 3 2; }

/* 多発の札（全国の上位などの条件に当たる県だけ。色に頼らず、角の黒い三角と文字の札で示す） */
.lm-flag { display: inline-block; padding: 1px 8px; margin-right: 6px; background: #B3260B; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.6; border-radius: var(--cmt-r-tag); white-space: nowrap; }
.lm-legend li[data-c="flag"] i { border: 0; height: 14px; background: linear-gradient(225deg, #B3260B 0 50%, transparent 50%); border: 1px solid var(--lm-heat-line); }
.lm-heat-rank .f { grid-column: 2 / 4; font-size: 12px; color: var(--cmt-text-sub); font-weight: 400; line-height: 1.5; padding-bottom: 6px; }

/* 地図の拡大・縮小ボタン（右下） */
.lm-zoom { position: absolute; right: 8px; bottom: 28px; z-index: 5; display: grid; box-shadow: 0 2px 8px rgba(22,32,43,.2); }
.lm-zoom button { width: 44px; height: 44px; border: 1px solid var(--cmt-line); background: #fff; color: var(--cmt-navy); font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; }
.lm-zoom button + button { border-top: 0; }

.lm-zoom .lm-zoom-style { font-size: 12px; font-weight: 700; border-top: 0; }
.lm-plain .tiles image { pointer-events: none; }
.lm-map-plainnote a { color: inherit; }

/* 点を押したあとに出るブラウザ標準の太い枠（大きな丸に見えていた）をやめ、点そのものに輪を付ける */
.lm-plain .pin, .lm-plain .heat { outline: none; }
.lm-plain .pin:focus-visible .face, .lm-plain .heat:focus-visible .face { stroke: var(--cmt-navy); stroke-width: 4; }
.lm-plain .pin:focus:not(:focus-visible) .face { stroke-width: 2; }

/* 地図（スマホ）: 出典は地図の下に小さく・緯度経度は左上に小さく・拡大縮小は左に小さく（メニューと被らない） */
@media (max-width: 1079px) {
  .lm-map-plainnote { position: static; max-width: none; padding: 3px 12px; font-size: 10px; line-height: 1.45; background: #fff; border-top: 1px solid var(--cmt-line); }
  .lm-map-range { left: 6px; top: 6px; bottom: auto; font-size: 10px; line-height: 1.4; padding: 1px 6px; }
  .lm-tray { top: 8px; right: 8px; padding: 2px; gap: 2px; }
  .lm-tray button { width: 44px; height: 38px; font-size: 9px; }
  .lm-tray svg { width: 16px; height: 16px; }
  .lm-zoom { left: 8px; right: auto; bottom: 36px; top: auto; box-shadow: 0 1px 4px rgba(22,32,43,.2); }
  .lm-zoom button { width: 34px; height: 34px; font-size: 17px; }
  .lm-zoom .lm-zoom-style { font-size: 10px; height: 26px; }
  .lm-mapbox[data-heat="true"] .lm-zoom { top: 52px; bottom: auto; }
  .lm-tab { display: none; }
}

/* 地図の絵が暗い地図（CARTO・今のサイトと同じ）のとき: 色・ピンの見え方を今のサイトにそろえる */
.lm-map--dark, .lm-map--dark .lm-map-slot { background: #2a3040; }
.lm-plain--dark .land { fill: #2a3040; stroke: #3a4256; }
.lm-plain--dark .japan { fill: #343c4f; stroke: #5b6579; }
.lm-plain--dark .tiles { filter: brightness(2) saturate(.9); }
.lm-plain .pin .face { stroke: #fff; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.lm-plain--dark .pin .face { filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.lm-plain--dark .pin--car .face { fill: #2f6db5; }
.lm-plain--dark .pin--bike .face { fill: #1f9e8f; }
.lm-plain--dark .pin--buyer .face { fill: #f59e0b; }
.lm-plain--dark .pin--buyer text { fill: #1b1e26; }
.lm-plain--dark .pin--found .face { fill: #3f4652; stroke: #7ee0a2; }
.lm-plain .pin text { font-weight: 700; }
.lm-lock { display: none; }
.lm-map-plainnote a, .lm-map-plainnote .lm-wheel-hint { color: inherit; }
.lm-wheel-hint { opacity: .85; }
@media (max-width: 1079px) {
  .lm-lock { display: block; position: absolute; right: 8px; bottom: 36px; z-index: 5; min-height: 40px; padding: 0 12px; border: 1px solid var(--cmt-line); background: rgba(255,255,255,.95); color: var(--cmt-navy); font: inherit; font-size: 13px; font-weight: 700; box-shadow: 0 1px 4px rgba(22,32,43,.3); }
  .lm-lock[aria-pressed="true"] { background: var(--cmt-navy); color: #fff; border-color: var(--cmt-navy); }
  .lm-mapbox[data-heat="true"] .lm-lock { display: none; }
  .lm-map--dark .lm-map-plainnote { background: #1b1e26; color: #b8c0cc; }
}

/* スマホの /map/ の切り替え（すべて・自動車・バイク・不審バイヤー）を 1 行の細い帯に。ラベルの横に件数を小さく。指で押せる高さ 40px は残す */
@media (max-width: 767px) {
  .lm-float-l .cmt-seg-wrap { padding: 1px 6px; }
  .lm-float-l .cmt-seg { display: flex; padding: 3px; gap: 2px; } /* 丸みのある形（parts.css の灰色の枠・丸い選択）に戻す。*/
  .lm-float-l .cmt-seg button { flex: 1 1 auto; flex-direction: row; gap: 3px; min-height: 34px; padding: 0 4px; white-space: nowrap; }
  .lm-float-l .cmt-seg-label { font-size: 13px; letter-spacing: 0; }
  .lm-float-l .cmt-seg-count { font-size: 11px; gap: 0; }
  .lm-float-l .cmt-seg-count .cmt-dot { display: none; }
}
/* 追加: 件数が 4 桁（1,793 など）になっても、1 行の帯のまま画面の外へ切れない。幅が足りないときは文字を少し小さくし、それでも足りなければ帯の中だけ横に送れる（ページ全体は横に伸びない） */
@media (max-width: 767px) {
  .lm-float-l .cmt-seg { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .lm-float-l .cmt-seg::-webkit-scrollbar { display: none; }
  .lm-float-l .cmt-seg button { flex: 1 0 auto; }
}
@media (max-width: 400px) {
  .lm-float-l .cmt-seg-label { font-size: 12px; }
  .lm-float-l .cmt-seg button { padding: 0 3px; gap: 2px; }
}

/* スマホで地図を画面いっぱいに開く形（開く = 地図の「全画面」・閉じる = 左上の「閉じる」）。閉じるとスクロール位置は元に戻る */
.lm-full-close { display: none; }
@media (max-width: 1079px) {
  .lm-mapbox[data-full="true"] { position: fixed; inset: 0; z-index: 200; width: auto; height: 100%; height: 100dvh; border: 0; }
  .lm-mapbox[data-full="true"] .lm-map-slot { height: 100% !important; min-height: 0 !important; }
  .lm-mapbox[data-full="true"] svg.lm-map { height: 100% !important; min-height: 0 !important; touch-action: none !important; }
  .lm-mapbox[data-full="true"] .lm-lock, .lm-mapbox[data-full="true"] .lm-tray, .lm-mapbox[data-full="true"] .lm-tray-pull, .lm-mapbox[data-full="true"] .lm-heat-top, .lm-mapbox[data-full="true"] .lm-legend { display: none !important; }
  .lm-mapbox[data-full="true"] .lm-full-close { display: inline-flex; align-items: center; justify-content: center; position: absolute; left: 8px; top: calc(8px + env(safe-area-inset-top)); z-index: 6; min-width: 72px; min-height: 44px; padding: 0 16px; border: 2px solid var(--cmt-navy); background: #fff; color: var(--cmt-navy); font: inherit; font-size: 15px; font-weight: 700; box-shadow: 0 2px 8px rgba(22,32,43,.35); }
  .lm-mapbox[data-full="true"] .lm-full-close[hidden] { display: none; }
  .lm-mapbox[data-full="true"] .lm-map-range { left: 90px; }
  .lm-mapbox[data-full="true"] .lm-zoom { top: auto; bottom: calc(60px + env(safe-area-inset-bottom)); }
  .lm-mapbox[data-full="true"] .lm-map-plainnote { position: absolute; left: 0; right: 0; top: auto; bottom: 0; height: auto; max-width: none; z-index: 5; }
  html.lm-fullmode, body.lm-fullmode { overflow: hidden; }
  /* 全画面のあいだ、押した点の記録の札は下に重ねて出す */
  /* 押した点の記録の札は、スマホでは（全画面でなくても）画面の下に固定する。下の固定ナビの上に出す。全画面のときは下いっぱい */
  .lm-pick:not([hidden]) { position: fixed; left: 0; right: 0; bottom: calc(var(--cmt-bnav-h, 56px) + env(safe-area-inset-bottom)); z-index: 60; max-height: 50vh; overflow-y: auto; background: var(--cmt-white); box-shadow: 0 -4px 16px rgba(22,32,43,.3); border-top: 3px solid var(--cmt-accent); padding-right: 52px; }
  body.lm-fullmode .lm-pick:not([hidden]) { bottom: env(safe-area-inset-bottom); z-index: 210; } /* 全画面の地図（z 200）より上。メニュー（z 100）より下は通常のとき */
  body.lm-pick-open:not(.lm-fullmode) { padding-bottom: 42vh; }
}

/* ---------- ピンを押したときの動き（部品） ----------
   選んだ点の色は凡例の「選んでいる点」（オレンジ）と同じ。右の一覧では、選んだ記録を先頭に、同じ色の線と薄い背景で出す */
.lm-pick { position: relative; }
.lm-pick-close { display: none; }
@media (max-width: 1079px) {
  .lm-pick-close { display: inline-flex; align-items: center; justify-content: center; position: absolute; right: 4px; top: 4px; z-index: 1; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--cmt-navy); font: inherit; font-size: 28px; line-height: 1; cursor: pointer; }
}
@media (min-width: 1080px) { .lm-pick { display: none !important; } }
.lm-picked { margin: 0 0 12px; border-left: 4px solid var(--cmt-accent); background: rgba(240,78,35,.08); }
.lm-picked .lm-day { margin-top: 0; }
.lm-picked .cmt-row { border-bottom: 0; }
.lm-pin-tip { position: absolute; z-index: 7; max-width: 260px; padding: 4px 8px; background: var(--cmt-navy); color: #fff; font-size: 12px; line-height: 1.4; pointer-events: none; transform: translate(-50%, -100%); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.lm-pin-tip[hidden] { display: none; }

/* ---------- ベクターの絵の層（MapLibre）。今の SVG（ピン・ヒート）は上に重ねる ---------- */
.lm-map-slot { position: relative; }
.lm-vecmap, .lm-vecmap.maplibregl-map { position: absolute; inset: 0; z-index: 0; }
.lm-vecmap .maplibregl-canvas { outline: none; }
.lm-map-slot > svg.lm-plain { position: relative; z-index: 1; }
/* 上の SVG（z-index 1）が、地図の右の 4 ボタン・範囲の文字・ヒートの見出しと凡例・出典を覆って押せなくしていた。どれも SVG より上（5）に出す（ズームの + - と同じ） */
.lm-tray, .lm-tray-pull, .lm-map-range, .lm-heat-top, .lm-legend, .lm-map-plainnote { z-index: 5; }
.lm-vec .lm-plain .land { fill: transparent; stroke: none; }
.lm-vec .lm-plain .japan { display: none; }

/* スマホは「地図の点は…」と出典を、地図の下の端に半透明の灰色の帯で小さく重ねる（PC は今までの形） */
.lm-overband { display: contents; }
.lm-note--over { display: none; }
@media (max-width: 1079px) {
  .lm-overband { display: block; position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(48, 56, 66, .78); color: #fff; pointer-events: none; }
  .lm-overband a { pointer-events: auto; }
  .lm-overband .lm-note--over { display: block; padding: 3px 8px 0; margin: 0; font-size: 10.5px; line-height: 1.4; color: #fff; }
  .lm-overband .lm-map-plainnote, .lm-mapbox[data-full="true"] .lm-overband .lm-map-plainnote { position: static; display: block; max-width: none; padding: 0 8px 3px; font-size: 10.5px; line-height: 1.4; background: transparent; border: 0; color: #fff; }
  .lm-overband .lm-map-plainnote a { color: #fff; text-decoration: underline; }
  .lm-foot .lm-note { display: none; }
  .lm-mapbox[data-heat="true"] .lm-overband { display: none; }
  .lm-zoom { bottom: calc(var(--lm-band-h, 64px) + 8px); }
  .lm-lock { bottom: calc(var(--lm-band-h, 64px) + 8px); }
  .lm-mapbox[data-full="true"] .lm-zoom { bottom: calc(var(--lm-band-h, 64px) + 8px + env(safe-area-inset-bottom)); }
  .lm-overband .lm-wheel-hint { display: none; } /* スマホに Ctrl キーは無い */
}

/* ===== スマホ（幅 1079 以下・縦向き）の /map/ は、最初から地図を画面いっぱいに開き、記録・いまの状況・凡例は下から引き出す窓にする。
   ヒートのとき（data-heat）は今までの縦に続く形のまま。右の 4 ボタン・帯の注記と出典・ズーム・丸い切り替え・件数は今までどおり ===== */
.lm-drawer-h, .lm-key-m { display: none; }
@media (max-width: 1079px) and (min-height: 521px) {
  body[data-zone-watch="map"]:has(.lm-mapbox:not([data-heat="true"])) { height: 100vh; height: 100dvh; overflow: hidden; }
  body[data-zone-watch="map"]:has(.lm-mapbox:not([data-heat="true"])) .cmt-footer,
  body[data-zone-watch="map"]:has(.lm-mapbox:not([data-heat="true"])) .cmt-bnav-spacer { display: none; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) {
    --lm-seg-h: 46px; --lm-peek: 56px;
    position: relative; display: block; overflow: hidden;
    height: calc(100vh - var(--lm-top-offset, 90px) - var(--cmt-bnav-h, 56px) - env(safe-area-inset-bottom));
    height: calc(100dvh - var(--lm-top-offset, 90px) - var(--cmt-bnav-h, 56px) - env(safe-area-inset-bottom));
  }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-left { position: absolute; left: 0; right: 0; top: var(--lm-seg-h); bottom: var(--lm-peek); }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-left .lm-mapbox,
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-left .lm-map-slot,
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-left svg.lm-map { height: 100% !important; min-height: 0 !important; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-left .lm-mapbox { border: 0; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-foot { display: none; }
  /* 上の切り替え: 地図の上に固定の細い帯（丸い切り替えのまま） */
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-l { display: contents; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-l .cmt-seg-wrap { position: fixed !important; top: var(--lm-top-offset, 90px); left: 0; right: 0; height: var(--lm-seg-h); box-sizing: border-box; z-index: 8; display: flex; align-items: center; background: #fff; border-bottom: 1px solid var(--cmt-line); }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-l .cmt-seg { width: 100%; }
  /* 下から引き出す窓 */
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-right {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; display: block; height: var(--lm-peek); overflow: hidden;
    background: #fff; border: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 16px rgba(22,32,43,.3); transition: height .25s ease;
  }
  .lm-top[data-drawer="open"]:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-right { height: 66%; overflow-y: auto; overscroll-behavior: contain; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-drawer-h {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 3; width: 100%; min-height: var(--lm-peek); box-sizing: border-box; padding: 14px 16px 0;
    border: 0; border-bottom: 1px solid var(--cmt-line); border-radius: 14px 14px 0 0; background: #fff; font: inherit; color: var(--cmt-navy); cursor: pointer; text-align: left;
  }
  .lm-drawer-h i { position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #B9C1CB; }
  .lm-drawer-h b { font-size: 16px; }
  .lm-drawer-n { font-size: 14px; font-weight: 700; color: var(--cmt-text-sub); }
  .lm-drawer-h em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 700; color: var(--cmt-text-sub); }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-r { display: block; position: static; width: auto; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-body { overflow: visible; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-key-m { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0; padding: 12px 16px 16px; font-size: 12px; font-weight: 700; color: var(--cmt-text); border-top: 1px solid var(--cmt-line); }
  .lm-key-m li { display: inline-flex; align-items: center; gap: 6px; }
}
/* 窓の中の並び: 記録（この範囲の記録）→ いまの状況 → 点の色（凡例） */
@media (max-width: 1079px) and (min-height: 521px) {
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-right { display: flex; flex-direction: column; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-top-right > * { flex: none; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-drawer-h { order: 0; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-r { order: 1; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-float-l .lm-now { order: 2; flex: none; }
  .lm-top:not(:has(.lm-mapbox[data-heat="true"])) .lm-key-m { order: 3; }
}
