/* layout: 左＝条件と一覧 (幅 420px)、右＝地図いっぱい。値段の札は地図上の吹き出し、高速の緑で運転時間 */
:root {
  --bg: #f3f4f1;
  --panel: #ffffff;
  --ink: #1d2320;
  --muted: #5d6762;
  --line: #d9ddd8;
  --sign: #146b45;
  --sign-ink: #ffffff;
  --hot: #c2410c;
  --hot-bg: #fff1e8;
  --chip: #eef2ee;
  --house: #7c2d12;
  --display: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  --body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); }
.app { display: grid; grid-template-columns: 420px 1fr; height: 100%; }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.head { padding: 12px 14px 6px; }
h1 { font: 900 20px/1.2 var(--display); margin: 0; }
.cond { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.filters { padding: 6px 14px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 8px; align-items: center; }
.row label { font-size: 12px; color: var(--muted); flex: none; }
select, input[type=text] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; }
.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg button, .tog { font: inherit; font-size: 12.5px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 3px 10px; }
.seg button[aria-pressed=true], .tog[aria-pressed=true] { background: var(--sign); border-color: var(--sign); color: var(--sign-ink); }
.tog.hot[aria-pressed=true] { background: var(--hot); border-color: var(--hot); }
.sliders { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.sliders b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sliders input { accent-color: var(--sign); width: 100%; }
.toggles { display: flex; flex-wrap: wrap; gap: 5px; }
.count { margin: 6px 14px; font-size: 12.5px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0 10px 10px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.item { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 104px 104px 1fr; min-height: 108px; overflow: hidden; cursor: pointer; }
.item:hover { border-color: var(--sign); }
.item.on { border-color: var(--sign); box-shadow: 0 0 0 2px var(--sign) inset; }
.item.fav { border-color: var(--hot); }
.item .ph { width: 104px; height: 108px; object-fit: cover; background: #fff; display: block; align-self: stretch; }
.item .ph.plan { object-fit: contain; border-left: 1px solid var(--line); }
.item .nophoto { display: grid; place-items: center; color: #999; font-size: 11px; background: #fafafa; }
.info { padding: 6px 8px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.price { font: 900 17px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.price small { font: 400 11px var(--body); color: var(--muted); margin-left: 3px; }
.spec { font-size: 12.5px; }
.sub { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.ic { font-size: 11.5px; }
.ic b { color: var(--sign); }
.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.chip { font-size: 10.5px; background: var(--hot-bg); color: var(--hot); font-weight: 700; border-radius: 3px; padding: 0 5px; }
.chip.new { background: var(--sign); color: var(--sign-ink); }
.more { margin: 0 10px 12px; padding: 8px; border: 1px solid var(--sign); background: var(--panel); color: var(--sign); border-radius: 6px; font: inherit; font-weight: 700; cursor: pointer; }
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8ebe6; }
.updated { position: absolute; right: 8px; bottom: 18px; z-index: 500; margin: 0; background: rgba(255,255,255,.9); padding: 2px 8px; border-radius: 4px; font-size: 11.5px; color: var(--muted); }

/* 値段の札 */
.tag { position: relative; display: inline-block; white-space: nowrap; transform: translate(-50%, -100%); background: var(--panel); color: var(--ink); border: 1.5px solid var(--sign); border-radius: 5px; padding: 1px 5px; font: 700 12px/1.3 var(--body); font-variant-numeric: tabular-nums; box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--sign); border-bottom: 0; }
.tag.house { background: var(--house); color: #fff; border-color: var(--house); }
.tag.house::after { border-top-color: var(--house); }
.tag.fav { background: var(--hot); color: #fff; border-color: var(--hot); }
.tag.fav::after { border-top-color: var(--hot); }
.tag.on { background: var(--sign); color: #fff; z-index: 1000; transform: translate(-50%, -100%) scale(1.25); }
.tag.approx { border-style: dashed; }
.leaflet-div-icon.pin { background: none; border: 0; }
.cl { display: inline-block; white-space: nowrap; transform: translate(-50%, -50%); border-radius: 999px; background: var(--sign); color: #fff; border: 2px solid rgba(255,255,255,.9); padding: 3px 9px; font: 700 13px/1.2 var(--body); font-variant-numeric: tabular-nums; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; }
.cl small { font-size: 11px; font-weight: 400; margin-left: 4px; opacity: .9; }
.origin { background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 4px; font: 700 12px var(--body); white-space: nowrap; transform: translate(-50%, -50%); display: inline-block; }

/* 吹き出しのカード */
.leaflet-popup-content { margin: 0; width: 300px !important; }
.pop .pics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.pop .pics button { border: 0; padding: 0; background: #fff; aspect-ratio: 4/3; cursor: zoom-in; }
.pop .pics img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pop .pics .plan img { object-fit: contain; }
.pop .txt { padding: 8px 10px 10px; display: grid; gap: 3px; font: 13px/1.45 var(--body); }
.pop a { color: var(--sign); font-weight: 700; }
.pop .acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pop .star { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; cursor: pointer; font: inherit; padding: 1px 8px; }
.pop .star[aria-pressed=true] { background: var(--hot); color: #fff; border-color: var(--hot); }

#lb { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.85); display: none; place-items: center; padding: 16px; cursor: zoom-out; }
#lb.on { display: grid; }
#lb figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
#lb img { max-width: 92vw; max-height: 84vh; background: #fff; border-radius: 6px; }
#lb figcaption { color: #fff; margin-top: 6px; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, .item:focus-visible { outline: 3px solid var(--sign); outline-offset: 2px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .mapwrap { order: -1; }
  .side { border-right: 0; border-top: 1px solid var(--line); }
  .filters { max-height: 40%; overflow-y: auto; }
}
#routebox { position: absolute; left: 10px; bottom: 28px; z-index: 600; width: min(380px, calc(100% - 70px)); background: var(--panel); border: 2px solid #1d4ed8; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.2); padding: 8px 10px; font-size: 13px; line-height: 1.55; }
#routebox[hidden] { display: none; }
.rb-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 3px; }
.rb-title { font-weight: 700; flex: 1; overflow-wrap: anywhere; }
.rb-close { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
#routebox b, .pop .route b { color: #1d4ed8; }
#routebox .free, .pop .route .free { color: var(--muted); font-size: 11.5px; }
.fitroute { margin-top: 5px; display: inline-block; border: 1px solid #1d4ed8; color: #1d4ed8; background: var(--panel); border-radius: 5px; font: inherit; font-size: 12px; padding: 2px 10px; cursor: pointer; }
.chip.nego { background: #fde68a; color: #78350f; }
.tog.nego[aria-pressed=true] { background: #b45309; border-color: #b45309; }
.tag.nego::before { content: "値"; display: inline-block; margin-right: 3px; padding: 0 3px; border-radius: 3px; background: #fde68a; color: #78350f; font-size: 10.5px; line-height: 1.4; vertical-align: 1px; }
.pop .deal { font-size: 12.5px; background: #fffbeb; border-radius: 5px; padding: 4px 7px; }
.pop .deal .nego-t { color: #b45309; }
#newbar { position: absolute; right: 10px; top: 10px; z-index: 600; border: 0; border-radius: 999px; padding: 7px 14px; background: #dc2626; color: #fff; font: 700 13px var(--body); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer; }
#newbar:disabled { background: var(--panel); color: var(--muted); border: 1px solid var(--line); box-shadow: none; cursor: default; font-weight: 400; }
#newbar[hidden] { display: none; }
.tag.isnew { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,.35), 0 1px 3px rgba(0,0,0,.25); }
.tag.isnew::after { border-top-color: #dc2626; }
.cl.has-new { box-shadow: 0 0 0 3px rgba(220,38,38,.55), 0 1px 4px rgba(0,0,0,.3); }
.cl-new { font-style: normal; background: #dc2626; color: #fff; border-radius: 999px; padding: 0 5px; margin-right: 4px; font-size: 11px; }
.chip.new { background: #dc2626; color: #fff; }
.tnew { font-style: normal; background: #dc2626; color: #fff; border-radius: 3px; padding: 0 3px; margin-right: 3px; font-size: 10.5px; }
.exitmark { display: inline-block; transform: translate(-50%, -50%); background: #ea580c; color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 1px 8px; font: 700 11.5px var(--body); white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.lg { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.lg-a { background: #1d4ed8; }
.lg-b { background: #ea580c; }
#routebox b.after, .pop .route b.after { color: #ea580c; }
.pk { font-size: 11.5px; color: var(--muted); }
.pk b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pk.near { color: #6d28d9; font-weight: 700; }
.tag.near { border-color: #6d28d9; }
.tag.near::after { border-top-color: #6d28d9; }
.tag.near::before { content: "P遠"; display: inline-block; margin-right: 3px; padding: 0 3px; border-radius: 3px; background: #ede9fe; color: #5b21b6; font-size: 10.5px; line-height: 1.4; vertical-align: 1px; }
.tag.nego.near::before { content: "値・P遠"; }
.pop .route { border: 1.5px solid #1d4ed8; border-radius: 6px; padding: 5px 8px; font-size: 12.5px; line-height: 1.55; }
.pop .route:empty { display: none; }
.areabar { position: absolute; left: 54px; top: 10px; z-index: 600; display: flex; gap: 6px; }
.areabar button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 13px; font: 700 13px var(--body); box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: pointer; }
.areabar #areadraw[aria-pressed=true], .areabar #areacircle[aria-pressed=true] { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.areabar #areaclear[hidden] { display: none; }
#map.drawing { cursor: crosshair; touch-action: none; }
#map.drawing .leaflet-marker-pane *, #map.drawing .leaflet-popup-pane * { pointer-events: none !important; }

/* 写真をまとめて見る */
.galbtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.galopen { border: 1px solid var(--sign); background: var(--sign); color: #fff; border-radius: 5px; padding: 3px 10px; font: 700 13px var(--body); cursor: pointer; }
#gal { position: fixed; inset: 0; z-index: 2500; background: #111; color: #fff; overflow-y: auto; padding: 0 16px 24px; }
#gal[hidden] { display: none; }
#gal .galhead { position: sticky; top: 0; z-index: 1; display: flex; gap: 14px; align-items: center; padding: 10px 0; background: #111; }
#gal .galtitle { flex: 1; font-size: 15px; }
#gal .galsv { color: #9cc3ff; font-weight: 700; }
#gal .galclose { border: 0; border-radius: 5px; padding: 6px 12px; font: 700 14px var(--body); cursor: pointer; }
#gal h3 { margin: 14px 0 6px; font-size: 14px; color: #ddd; }
#gal .galgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
#gal .galgrid button { border: 0; padding: 0; background: #222; cursor: zoom-in; position: relative; aspect-ratio: 4/3; border-radius: 4px; overflow: hidden; }
#gal .galgrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
#gal .galgrid.plan button { background: #fff; }
#gal .galgrid.plan img { object-fit: contain; }
#gal .galgrid span { position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 6px; }
.chip.waunk { background: #fff4d6; color: #7a5200; }

/* カードを小さく (前の 6 割ちょっと)。中の並びはそのまま、文字と余白だけ縮める */
.leaflet-popup-content { width: 190px !important; }
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-close-button { transform: scale(.8); transform-origin: top right; }
.pop .txt { padding: 5px 6px 6px; gap: 2px; font-size: 9px; line-height: 1.4; }
.pop .price { font-size: 12px; }
.pop .price small { font-size: 7.5px; }
.pop .pk, .pop .sub, .pop .route .free { font-size: 8px; }
.pop .chips { gap: 2px; }
.pop .chip { font-size: 7.5px; padding: 0 3px; }
.pop .deal { font-size: 8.5px; padding: 2px 5px; border-radius: 4px; }
.pop .route { font-size: 8.5px; padding: 3px 5px; border-width: 1px; border-radius: 4px; }
.pop .fitroute { font-size: 8px; padding: 1px 6px; margin-top: 3px; }
.pop .galbtns { gap: 5px; margin: 1px 0; }
.pop .galopen { font-size: 9px; padding: 2px 6px; border-radius: 4px; }
.pop .acts { gap: 6px; }
.pop .star { padding: 0 5px; border-radius: 4px; }
.pop .lg { width: 12px; height: 3px; }
/* つかんで動かす */
.leaflet-popup-content-wrapper { cursor: grab; touch-action: none; }
.leaflet-popup.dragging .leaflet-popup-content-wrapper { cursor: grabbing; user-select: none; }
.leaflet-popup.dragged .leaflet-popup-tip-container { display: none; }
.leaflet-popup.dragged .leaflet-popup-content-wrapper { box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.pop img { -webkit-user-drag: none; user-select: none; }

/* 左側を詰める (11-13): 前提の条件と絞り込みは畳める、並び順は一覧の直前、お気に入りはタブで一発 */
.head { padding: 8px 12px 4px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
h1 { font-size: 16px; }
.base { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; }
.base summary { cursor: pointer; }
.base .cond { margin: 2px 0 0; font-size: 11px; line-height: 1.45; }
.tabs { display: flex; gap: 6px; padding: 4px 12px 6px; }
.tab { flex: 1; font: 700 13px var(--body); cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 6px 8px; }
.tab[aria-pressed=true] { background: var(--sign); border-color: var(--sign); color: #fff; }
.tab.fav[aria-pressed=true] { background: var(--hot); border-color: var(--hot); }
.tab.fav b { font-variant-numeric: tabular-nums; }
.filters { padding: 0 12px; display: block; border-bottom: 1px solid var(--line); }
.filters summary { cursor: pointer; padding: 6px 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters .fsum { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.filters[open] .fsum { display: none; }
.fbody { display: grid; gap: 7px; padding: 0 0 8px; }
.side.favmode .filters, .side.favmode #inview { display: none; }
.listhead { padding: 5px 12px 4px; display: flex; flex-direction: column; gap: 4px; }
.listhead .count { margin: 0; font-size: 12px; }
.lhrow { display: flex; gap: 6px; align-items: center; }
.lhrow select { width: auto; flex: 1; padding: 3px 6px; font-size: 12.5px; }
.lhrow .tog { white-space: nowrap; }
.info { position: relative; }
.lstar { position: absolute; top: 2px; right: 4px; border: 0; background: none; cursor: pointer; font-size: 19px; line-height: 1; color: #b9b9b9; padding: 2px; }
.lstar[aria-pressed=true] { color: var(--hot); }

/* 家賃と広さは下限・上限の 2 つのつまみ */
.dual { position: relative; height: 26px; }
.dual::before { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 2px; background: var(--line); }
.dual .fill { position: absolute; top: 11px; height: 4px; border-radius: 2px; background: var(--sign); }
.dual input { position: absolute; left: 0; top: 0; width: 100%; height: 26px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual input::-webkit-slider-runnable-track { background: none; height: 26px; }
.dual input::-moz-range-track { background: none; }
.dual input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; background: var(--sign); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--sign), 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.dual input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--sign); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--sign); cursor: pointer; }
.item .ph:not(.nophoto) { cursor: zoom-in; }

.ringtip { font: 700 12px var(--body); }
#map.drawing .leaflet-marker-pane .actl, #map.drawing .leaflet-marker-pane .actl * { pointer-events: auto !important; }
.leaflet-interactive.acircle { cursor: move; }
#map.movingarea, #map.movingarea * { cursor: grabbing !important; }
/* 鉛筆で描いている時は円を素通りさせて、円の内側からも線を引けるようにする */
#map.drawing-pen .leaflet-interactive.acircle { pointer-events: none; }
.actl { display: flex; justify-content: space-between; background: none; border: 0; }
.actl span { display: grid; place-items: center; width: 26px; height: 26px; background: #fff; color: #7c3aed; border: 2px solid #7c3aed; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); font: 700 13px/1 var(--body); cursor: pointer; }
.actl .adelx { font-size: 15px; }
.actl span:hover { background: #7c3aed; color: #fff; }
.actl.muted .amute { background: #6b7280; border-color: #6b7280; color: #fff; }
.actl.muted .adelx { color: #6b7280; border-color: #9ca3af; }

.demo { margin: 2px 0 0; font-size: 11px; color: #b45309; }
