:root {
  /* Brand palette */
  --yellow: #FECD08;
  --yellow-soft: #E5B600;
  --yellow-bg: #FFFDF5;

  /* Category pastels */
  --pastel-yellow: #FFF4D0;
  --pastel-blue:   #DCEBFF;
  --pastel-mint:   #DCF3E2;
  --pastel-lilac:  #E8E1F5;
  --pastel-peach:  #FFE6D6;

  /* Neutrals */
  --bg: #ffffff;
  --bg-soft: #F2F2F2;
  --ink: #1D1D1C;
  --ink-2: #4A4A4A;
  --ink-3: #6D7885;
  --rule: #CDD0D3;
  --rule-soft: #F2F2F2;
  --gold-text: #9E8213;

  /* Demographic chip colors */
  --eth-peach: #FFEEE6;
  --eth-blue:  #EFF7FF;
  --eth-green: #EBFFE5;
  --eth-lav:   #F1F0FF;

  /* Accents (originals from data) */
  --green:  #4CAF50;
  --blue:   #3E8FD9;
  --purple: #8E6BC4;
  --orange: #FF9F43;
  --red:    #E85A4F;
  --korean: #E63946;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* =========== APP LAYOUT =========== */
:root {
  --sidebar-w: 300px;
  --sidebar-w-min: 240px;
  --sidebar-w-max: 480px;
}
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  padding-top: 0;
}
.app.resizing { user-select: none; cursor: col-resize; }
.app.resizing iframe,
.app.resizing #map { pointer-events: none; }

/* =========== SIDEBAR =========== */
.sidebar {
  background: white;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 사이드바 스크롤 영역 — 로고 고정, 전체 내용 함께 스크롤 */
.sidebar-content {
  flex: 1 1 0%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }

/* 구분선 — height:1px div, 16px 안쪽 여백 */
.gp-divider {
  height: 1px;
  background: var(--rule-soft);
  margin: 0;
  flex-shrink: 0;
}

/* STEP 섹션 공통 패딩 */
.gp-section {
  padding: 11px;
}
/* STEP 1/2 최상위 라벨에만 적용 — 안쪽 필드 라벨(학년·인기필터 등)은 제외 */
.gp-section > .gp-label {
  margin-bottom: 12px;
}

/* SOL 로고 헤더 바 */
.sidebar-logo-bar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--rule-soft);
  flex-shrink: 0;
  background: white;
}
.sidebar-logo-img {
  height: 30px;
  width: auto;
  display: block;
  object-fit: contain;
}
@media (max-width: 720px) {
  .sidebar-logo-bar { display: none; }
}

/* Sidebar resize handle — Google Maps / IDE-style draggable divider */
.sidebar-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 600;
  background: transparent;
  transition: background-color .18s ease;
}
.sidebar-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  transform: translateY(-50%);
  width: 3px;
  height: 36px;
  border-radius: 2px;
  background: transparent;
  transition: background-color .18s ease, height .18s ease;
}
.sidebar-resize:hover::after {
  background: var(--ink-3);
  height: 48px;
}
.app.resizing .sidebar-resize::after {
  background: var(--yellow);
  height: 60px;
}
.sidebar-resize:focus-visible {
  outline: none;
}
.sidebar-resize:focus-visible::after {
  background: var(--yellow);
}
/* Hide handle on mobile */
@media (max-width: 900px) {
  .sidebar-resize { display: none; }
}

/* Hero — legacy (모바일 플로팅용으로만 남김) */
.hero { padding: 0; background: white; position: relative; display: flex; flex-direction: column; gap: 0; }
.eyebrow, .hero h1 { display: none; }
.hero p { color: var(--ink-3); font-size: 14px; line-height: 1.45; margin: 0; }

/* City switch — horizontal scrollable pill chips (Google Maps style) */
.city-switch {
  display: flex;
  gap: 8px;
  margin: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 22px 4px 2px;
  margin: -2px -22px -4px -2px;
  scroll-padding-right: 22px;
  /* Right-edge fade — clear affordance that more cities scroll into view */
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
}
.city-switch.no-overflow {
  mask-image: none;
  -webkit-mask-image: none;
}
.city-switch::-webkit-scrollbar { display: none; }
.city-switch button {
  flex: 0 0 auto;
  background: white;
  border: 1px solid var(--rule);
  padding: 0 14px;
  height: 32px;
  border-radius: 30px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s;
}
.city-switch button:hover {
  background: var(--bg-soft);
}
.city-switch button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 500;
}

/* ===== 학교 찾기 가이드 ===== */
.guide-panel { gap: 0; padding: 0; background: white; overflow: visible; }

/* 가이드 인트로 — reference HTML과 정확히 일치 */
.gp-intro {
  padding: 16px;
}
.gp-brand { display: none; }
.gp-brand-icon { display: none; }
.gp-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--ink);
}
.gp-desc {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-3);
  margin: 0;
}
.gp-head { display: flex; align-items: center; justify-content: space-between; }
.gp-title { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.gp-title .gp-ic {
  width: 22px; height: 22px; border-radius: 7px; background: var(--yellow);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.gp-toggle {
  background: none; border: 0; color: var(--ink-3); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 4px 2px; font-family: inherit;
}
.gp-toggle:hover { color: var(--ink); }
.gp-body {
  display: flex; flex-direction: column; gap: 0;
  overflow: visible; max-height: none;
}
.gp-body.collapsed { display: none; }
.gp-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* 렌트비 필드만 gap 12 (라벨행 → 슬라이더 → 축) */
.gp-field:has(.lb-dual-slider) { gap: 12px; }
.gp-label { font-size: 12px; font-weight: 500; line-height: 18px; color: var(--ink-3); letter-spacing: 0; }
.gp-label .gp-sub { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.gp-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: 100%;
  min-width: 0;
}
.gp-chip {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--rule);
  padding: 0 8px;
  height: 26px;
  border-radius: 30px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gp-chip:hover { background: var(--bg-soft); }
.gp-chip:active { transform: scale(.97); }
/* 단일 선택(학년): 검정 활성 */
.gp-chips.single .gp-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
/* 균등 폭 칩 (학년 등) — 참조: 자연 너비, 좌우 늘이기 없음 */
.gp-chips-equal { flex-wrap: nowrap; }
.gp-chips-equal .gp-chip { flex: 0 0 auto; text-align: center; justify-content: center; }
/* 복수 선택(인기 필터): 기본 칩과 동일 크기(26/8px/12) — 활성 색상만 별도 */
.gp-chips.multi .gp-chip.active {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow);
  color: var(--ink);
}
.gp-result {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  border-top: 1px dashed var(--rule); padding-top: 6px;
}
.list-bar .gp-result {
  border-top: none; padding-top: 0; margin-left: auto;
  white-space: nowrap; min-width: 0; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis;
  font-size: 11.5px; gap: 5px;
  font-variant-numeric: tabular-nums;
}
.list-bar .gp-result-sep { color: var(--ink-3); opacity: .65; padding: 0 1px; }
.gp-result b { color: var(--ink); font-weight: 800; }
.gp-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(76,175,80,.5); animation: gpPulse 1.8s infinite;
}
@keyframes gpPulse {
  0% { box-shadow: 0 0 0 0 rgba(76,175,80,.45); }
  70% { box-shadow: 0 0 0 7px rgba(76,175,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

/* Filters — Google Maps style: tight padding, no bottom border (chips below own it) */
.filters {
  padding: 14px 16px 8px;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
}

/* Search examples — clickable hint chips beneath the search input */
.search-examples {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}
.search-examples-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 1px;
}
.search-example {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--bg-soft);
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  font-family: inherit;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.search-example:hover {
  background: var(--yellow-bg);
  border-color: rgba(254,205,8,.4);
  color: var(--ink);
}
.search-example:active { transform: translateY(0.5px); }
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  pointer-events: none;
  z-index: 3;
  flex-shrink: 0;
}
.search input {
  width: 100%;
  border: 1px solid var(--rule);
  background: white;
  padding: 0 112px 0 40px;
  height: 44px;
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: box-shadow .18s ease, border-color .15s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(10,13,18,.05);
}
.search input:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.04);
}
.search input:focus {
  border-color: var(--yellow);
  background: white;
  box-shadow: 0 1px 2px rgba(10,13,18,.05), 0 0 0 3px rgba(254,205,8,.18);
}
.search input::placeholder { color: var(--ink-3); }
.search-clear {
  position: absolute; right: 76px;
  background: none; border: none;
  font-size: 22px; font-weight: bold;
  line-height: 1;
  cursor: pointer; color: var(--ink-3);
  display: none; padding: 4px;
  z-index: 3;
}
.search-clear.visible { display: block; }
.search-clear:hover { color: var(--ink); }

.search-btn {
  position: absolute; right: 10px;
  background: none;
  color: var(--ink-3);
  border: none;
  padding: 4px 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color .15s ease;
  z-index: 3;
  white-space: nowrap;
}
.search-btn:hover { color: var(--ink); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-3);
  padding: 2px 2px 0;
}
.toggle-row .count { color: var(--ink-3); font-weight: 500; }
.toggle-row .count b { color: var(--ink); font-weight: 700; }
.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.toggle input { display: none; }
.toggle .track {
  width: 34px; height: 20px;
  background: #E5E5E5;
  border-radius: 999px;
  position: relative;
  transition: background .2s;
}
.toggle .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .track { background: var(--yellow); }
.toggle input:checked + .track::after { transform: translateX(14px); }

.count {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}
.count b { color: var(--ink); font-weight: 700; }

/* Place list — sidebar-content가 통합 스크롤하므로 독립 스크롤 제거 */
.list {
  flex: none;
  overflow-y: visible;
  padding: 0;
  background: white;
}
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }

.city-group {
  padding: 0 16px 20px;
}

.city-label {
  padding: 12px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.city-label .num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.place {
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  display: block;
  border: 1px solid var(--rule);
  background: white;
}
.place:hover {
  background: var(--bg);
  border-color: var(--rule);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.city-group .place:last-child { margin-bottom: 0; }
.place.active {
  background: var(--yellow-bg);
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(254,205,8,.12);
}
.place-name {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.place-nm-en {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.place-nm-ko {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}
.place-en {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0;
}
.place-area {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0 0 2px;
  font-weight: 400;
}
.place-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.place-rent {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.ko-tag {
  font-size: 11px;
  background: #FFECA2;
  color: var(--ink);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.place-meta {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  font-weight: 400;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.place-meta .region { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-meta .rent { color: var(--ink-2); font-weight: 500; flex-shrink: 0; }

.place-info {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100, #f3f4f6);
}
.place-info-desc {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
  text-wrap: pretty;
}
.place-infra-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #065f46;
  background: #d1fae5;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 6px;
  letter-spacing: .02em;
}

.detail-head--slim { padding: 14px 24px 14px; }
.detail-head--slim .detail-head-top { margin-bottom: 0; }

.swatch-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  margin-top: 2px;
}

/* =========== MAP =========== */
.map-wrap {
  position: relative;
  background: var(--bg-soft);
}
#map {
  height: 100vh;
  width: 100%;
  background: #EDF2F7;
}
.leaflet-container {
  font-family: 'Noto Sans KR', sans-serif !important;
  background: #EDF2F7 !important;
}
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important;
  margin-right: 24px !important;
  margin-bottom: 24px !important;
}
.leaflet-control-zoom a {
  background: white !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 0 !important;
  width: 36px !important; height: 36px !important;
  line-height: 34px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}
.leaflet-control-zoom a:first-child { border-radius: 12px 12px 0 0 !important; }
.leaflet-control-zoom a:last-child  { border-radius: 0 0 12px 12px !important; border-top: none !important; }
.leaflet-control-zoom a:hover { background: var(--yellow-bg) !important; color: var(--ink) !important; }
.leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-radius: 6px 0 0 0 !important;
}

/* Map header overlay — search bar + POI tags (Mart/Hospital/Library/Leisure/Parks).
   INVARIANT: must stay visible at every zoom level. `position: fixed` anchors it to
   the viewport (independent of Leaflet's pan/zoom transforms, which only touch panes
   inside #map), and z-index 800 sits above all map panes (≤700) yet below the zoom
   control (1000) so the +/− buttons stay clickable. Do NOT add a transform to any
   ancestor (.app/.map-wrap) — that would break `fixed` containment and let zoom hide
   it. Regression-guarded by tests/search-overlay-zoom.spec.mjs. */
.map-overlay {
  position: fixed;
  top: 24px;
  left: calc(var(--sidebar-w) + 24px);
  z-index: 800;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: calc(100vw - var(--sidebar-w) - 48px);
}
.map-overlay .search {
  width: 260px;
  flex-shrink: 0;
}
/* 데스크톱 map-overlay: search-btn 숨기고 padding 최적화 → placeholder 전체 표시 */
.map-overlay .search .search-btn { display: none; }
.map-overlay .search .search-clear { right: 10px; }
.map-overlay .search input { padding-right: 36px; }
.map-chip {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-chip .label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========== MART TOGGLE (desktop) ========== */
.mart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 30px;
  background: white;
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all .18s;
}
.mart-toggle .mart-toggle-ico { display: block; flex-shrink: 0; }
svg.mart-toggle-ico { display: block; flex-shrink: 0; }
.mart-toggle:not(.on):hover { background: var(--bg-soft); }
.mart-toggle.on {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}

/* 기존 통합 facility 패널 숨김 — 카테고리별 팝업으로 대체 */
#facilityFilterPanel { display: none !important; }

/* ========== 카테고리 버튼 래퍼 ========== */
.cat-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.cat-btn-wrap {
  position: relative;
}

/* ── 카테고리 팝업 (dropdown) ── */
.cat-popup {
  display: none;
  position: absolute;
  top: 40px;
  left: 0;
  z-index: 40;
  width: 310px;
  background: white;
  border-radius: 6px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  padding: 6px 0 10px;
}
.cat-popup.show { display: block; }

.cat-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 3px;
}
.cat-popup-divider {
  border-top: 1px solid #f2f2f2;
  margin: 0 0 5px;
}
.cat-popup-title { font-size: 12px; font-weight: 500; color: var(--ink); }
.cat-popup-reset {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.cat-popup-reset:hover { color: var(--ink); }

.cat-popup-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px;
}
.cat-popup-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  height: 32px;
  padding: 0 11px;
  border-radius: 30px;
  background: white;
  border: 1px solid #cdd0d3;
  color: #1d1d1c;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transition: border-color .18s ease;
}
.cat-popup-chip.on {
  background: white;
  border-color: var(--yellow);
}
.cat-popup-chip img,
.cat-popup-chip svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 버튼 내 선택 수 뱃지 */
.mart-toggle-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 30px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
}

/* ========== MART FILTER PANEL ========== */
.mart-filter-panel {
  position: absolute;
  top: 74px;
  left: 24px;
  z-index: 800;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 320px;
}
.mart-filter-panel.show { display: flex; }

/* 통합 facility 패널 — 마트/병원 섹션을 세로로 적층 */
.facility-filter-panel {
  flex-direction: column;
  gap: 0;
  padding: 10px 12px;
  min-width: 220px;
  max-width: 340px;
}
.facility-filter-panel .filter-section {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 6px 0;
}
.facility-filter-panel .filter-section.show { display: flex; }
.facility-filter-panel .filter-section.show ~ .filter-section.show {
  border-top: 1px solid var(--rule);
  margin-top: 4px;
  padding-top: 10px;
}

/* 섹션 헤더: 라벨 + 화살표 버튼 */
.filter-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}
.filter-section-collapse {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--ink-3);
  opacity: 0.6;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.filter-section-collapse:hover { opacity: 1; }
.filter-collapse-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  display: block;
}
.filter-section.collapsed .filter-collapse-chevron {
  transform: rotate(-90deg);
}

/* 섹션 버튼 목록 */
.filter-section-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.2s ease, padding-top 0.2s ease, opacity 0.2s ease;
  opacity: 1;
}
.filter-section.collapsed .filter-section-body {
  max-height: 0;
  padding-top: 0;
  opacity: 0;
  pointer-events: none;
}

.filter-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.mart-filter-btn {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  opacity: 0.45;
  transition: all .15s;
}
.mart-filter-btn .dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.mart-filter-btn.on { opacity: 1; color: var(--ink); border-color: #cdd0d3; }
.mart-korean.on { border-color: #fecd08; }
.park-filter-btn.on { border-color: #fecd08; }
.hospital-filter-btn.on { border-color: #cdd0d3; }
.mart-filter-btn:hover { transform: translateY(-1px); }
.filter-emoji {
  font-size: 20px;
  line-height: 1;
  display: inline-block;
}
.park-filter-btn .lbl,
.hospital-filter-btn .lbl,
.leisure-filter-btn .lbl {
  font-size: 14px;
  font-weight: 500;
  color: #1d1d1c;
}
.leisure-filter-btn.on { border-color: #cdd0d3; }

/* ========== MART MAP MARKERS ========== */
.mart-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.mart-pin {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid #CDD0D3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s;
}
.mart-pin:hover { transform: scale(1.15); }
.mart-pin-letter { pointer-events: none; }

/* ========== FACILITY MAP MARKERS (HOSPITAL / LIBRARY) ========== */
.facility-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.facility-pin {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid #CDD0D3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s;
}
.facility-pin:hover { transform: scale(1.18); }
.facility-pin-emoji {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}
.facility-pin { color: #444; }
.facility-pin svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

/* ========== SCHOOL MAP MARKERS (region 학교 emoji pin) ========== */
.school-pin-wrap {
  background: transparent;
  border: none;
  pointer-events: auto;
}
.school-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.18s ease, filter 0.18s ease;
}
/* 학교 마커 SVG 아이콘 (이모지 대체) — 원/테두리/그림자는 SVG 내부에 포함됨 */
.school-svg-icon {
  display: block;
  width: 32px; height: 32px;
  transition: transform 0.18s ease, filter 0.18s ease;
}
/* School_SOL.svg도 viewBox를 32로 보정해 원이 박스를 꽉 채우므로 일반 아이콘과 동일 크기 */
.school-svg-icon--sol { width: 32px; height: 32px; }

/* ── 학교 이름 레이블 (줌인 시 표시) ── */
.school-pin-with-label {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.school-name-label {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  padding: 2px 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.14);
  cursor: pointer;
  pointer-events: auto;
  z-index: 620;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.school-name-label:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.map-wrap.zoom-school-label .school-name-label {
  display: block;
}

/* SOL 매칭 학교 — 추천 배지(⭐) 표시 */
/* CRM 스튜디오 마커 */
.crm-pin-wrap { z-index: 590; }
.crm-pin {
  width: 24px; height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.school-pin-wrap--sol { z-index: 600; }
.school-pin--sol {
  width: 28px; height: 28px;
  font-size: 16px;
  border: 2.5px solid #F59E0B;
  box-shadow: 0 2px 7px rgba(245,158,11,0.35);
  filter: none;
}

/* 필터 chip의 dot 영역에 들어가는 SVG 아이콘 */
.mart-filter-btn .dot svg { width: 12px; height: 12px; display: block; }

/* 필터 섹션 라벨 옆 작은 아이콘 */
.filter-section-label { display: inline-flex; align-items: center; gap: 5px; }
.filter-section-label-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}
.filter-section-label-ico svg { width: 12px; height: 12px; display: block; }

/* SVG 토글 아이콘 — 텍스트 라벨과 정렬 */
svg.mart-toggle-ico { display: inline-block; flex-shrink: 0; }
svg.mart-mark { display: inline-block; vertical-align: -2px; margin-right: 3px; flex-shrink: 0; }
/* =========== MARKERS =========== */
.pin {
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.map-wrap:not(.zoom-close) .pin:not(.active) {
  opacity: 0;
  pointer-events: none;
}
.pin .core {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  transition: transform .2s;
}
.pin .ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
  border: 2px solid currentColor;
}
.label-always {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: none;
  white-space: nowrap;
  font-family: inherit;
  /* Halo effect for readability on map */
  text-shadow: 
    -1.5px -1.5px 0 #fff,  
     1.5px -1.5px 0 #fff,
    -1.5px  1.5px 0 #fff,
     1.5px  1.5px 0 #fff,
     0px 0px 4px rgba(255,255,255,0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.map-wrap.zoom-close .label-always,
.pin.active .label-always {
  opacity: 1;
}
.label-always .ko {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.label-always .en {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.pin:hover .core { transform: scale(1.25); }
.pin.active .ring {
  opacity: 1;
  width: 36px; height: 36px;
}
.pin.active .core { transform: scale(1.2); }

/* 학교가 없는 지역: 회색 점 + 흐린 라벨 + 호버 효과 제거 (비활성화 느낌이 들지 않도록 톤업) */
.pin-wrap.no-schools { cursor: default; }
.pin-wrap.no-schools .pin { cursor: default; opacity: 0.85; }
.pin-wrap.no-schools .pin .core {
  background: #a6b4c9 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.pin-wrap.no-schools .pin:hover .core { transform: none; }
.pin-wrap.no-schools .label-always .ko { color: var(--ink-2); font-weight: 700; }
.pin-wrap.no-schools .label-always .en { color: #8e98a8; }

.marker-cluster-custom {
  background-clip: padding-box;
  border-radius: 50%;
  background: var(--yellow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--ink);
  border: 2px solid white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  font-size: 13px;
}

/* =========== DETAIL DRAWER =========== */
.detail {
  position: absolute;
  top: 0; right: 0;
  width: 384px;
  height: 100vh;
  background: white;
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -6px 0 32px rgba(0,0,0,0.08);
}
.detail.open { transform: translateX(0); }

/* ── 새 디자인 detail 상단 헤더 바 ── */
.detail-top-bar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--rule);
  background: white;
  position: sticky;
  top: 0;
  z-index: 5;
}
.detail-top-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
#d-title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
#d-title .d-title-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#d-title .d-title-count {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
}
/* d-school-count는 이제 detail-top-bar 안에 있으므로 숨김 처리 불필요 */
.detail-top-count {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-3);
  white-space: nowrap;
}
.detail-top-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.detail-top-close:hover { opacity: 0.6; }

.detail-region-tag {
  background: rgba(0,0,0,0.78);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.detail-close {
  flex-shrink: 0;
  background: #f0f0f0;
  border: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: all .15s;
}
.detail-close:hover { background: var(--ink); color: white; }

.detail-head {
  padding: 18px 24px 18px;
  border-bottom: 1px solid var(--rule);
}
.detail-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.detail-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-en {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 14px;
}
.detail-desc {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-soft);
}
.stat {
  padding: 18px 24px;
}
.stat + .stat {
  border-left: 1px solid var(--rule);
}
.stat .lab {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 700;
}
.stat .val {
  font-size: 22px;
  line-height: 1.1;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.stat .sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
}
.sub-link {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sub-link:hover { color: var(--ink); }

.rent-source {
  margin: 0;
  padding: 6px 32px 8px;
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: right;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
}
.rent-source a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rent-source a:hover { color: var(--ink); }

.detail-body {
  overflow-y: auto;
  flex: 1 1 0%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.section-label {
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink-3);
  margin: 0 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}
.section-label .d-title-name {
  color: var(--ink);
  font-weight: 800;
  margin-right: 4px;
}
.section-label .ct {
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
}
.section-label .sl-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label .detail-close {
  width: 30px;
  height: 30px;
  background: transparent;
  color: var(--ink-3);
}
.section-label .detail-close:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.schools {
  display: contents; /* detail-body gap으로 대체 */
}

/* ══════════ School card ══════════ */
.school-row {
  background: white;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  display: block;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .2s ease;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.school-row:not(.no-link) { cursor: pointer; }
a.school-row.has-link { display: block; }
.school-row:not(.no-link):hover {
  border-color: #DEDEDE;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.school-row.no-link:hover { border-color: var(--rule); box-shadow: none; }

/* Selected: yellow border (특정도를 hover보다 높여 항상 우선) */
.school-row.selected,
.school-row:not(.no-link).selected:hover,
.school-row.no-link.selected:hover {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1.5px var(--yellow), 0 4px 18px rgba(254,205,8,.16);
  background: var(--yellow-bg);
}

.school-row .sc-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* ── 헤더: 학교명+한글명(좌) / SOL·홈페이지(우) ── */
.school-row .sc-nm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px;
}
.school-row .sc-nm-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}
.school-row .sc-nm-left .nm-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  color: var(--ink);
}
.school-row .nm-ko {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  margin: 0;
}
.school-row .sc-nm-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 0;
}

/* "홈페이지 ↗" — inline-flex SVG 화살표 */
.school-row .ext-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .15s;
}
.school-row .ext-link:hover { opacity: 0.6; }
.school-row .ext-link-arrow { display: none; } /* SVG로 대체 */

/* ── 태그 (모두 동일한 아웃라인 pill) ── */
.school-row .sc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.school-row .sc-tag,
.school-row .t-total {
  background: white;
  border: 1px solid #cdd0d3;
  border-radius: 30px;
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.school-row .sc-tag + .sc-tag::before { display: none; }

/* ── 설명 박스 (회색 + 3줄 클램프 + 더보기) ── */
/* 배경·패딩은 바깥 wrap에 — 안쪽 텍스트는 패딩 없이 정확히 3줄만 클리핑 */
.school-row .sc-desc-wrap {
  position: relative;
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 7px;
  margin-bottom: 10px;
}
.school-row .sc-desc {
  margin: 0;
  font-size: 12px;
  line-height: 18px;
  color: #000;
  display: block;
  max-height: calc(18px * 3);
  overflow: hidden;
  text-wrap: pretty;
}
.school-row .sc-desc-wrap.expanded .sc-desc {
  max-height: none;
}
.school-row .sc-desc-more {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 0 0 0 42px;
  background: linear-gradient(90deg, rgba(242,242,242,0) 0, var(--bg-soft) 22px);
}
.school-row .sc-desc-more:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.school-row .sc-desc-wrap.expanded .sc-desc-more {
  position: static;
  display: block;
  padding: 8px 0 0;
  background: none;
}

.data-source {
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.5;
  text-align: right;
}
.data-source a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.data-source a:hover { color: var(--ink); }

/* CTA banner inside detail */
.consult-cta {
  margin-top: 0;
  background: linear-gradient(135deg, var(--yellow-bg) 0%, #FFEFB4 100%);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.consult-cta .txt {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}
.consult-cta .txt small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 500;
  margin-top: 2px;
}
.consult-cta .cta-mini {
  background: var(--ink);
  color: var(--yellow);
  border: 0;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
  transition: all .2s ease;
}
.consult-cta .cta-mini:hover {
  background: var(--yellow);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* hint */
.hint {
  position: absolute;
  bottom: 28px; right: 28px;
  background: var(--ink);
  color: white;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 800;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  animation: float 2.4s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint::before {
  content: "💡";
  font-size: 14px;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
/* ── 사이드 닫기 탭 (데스크톱 전용) ── */
.detail-collapse-tab {
  display: none; /* 모바일에서 숨김, 데스크톱에서 활성화 */
  position: absolute;
  left: -34px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 60px;
  background: white;
  border: 1px solid var(--rule);
  border-right: none;
  border-radius: 12px 0 0 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: -4px 0 14px rgba(0,0,0,0.08);
  transition: background .15s, color .15s;
  color: var(--ink-3);
  z-index: 10;
  padding: 0;
}
.detail-collapse-tab:hover { background: var(--bg-soft); color: var(--ink); }
.detail-collapse-tab svg { display: block; }

@media (min-width: 901px) {
  /* 데스크톱: 화면 최상단부터, 부드러운 왼쪽 모서리 */
  .detail {
    top: 0;
    height: 100vh;
    border-radius: 0;
    border-left: 1px solid var(--rule);
    box-shadow: -6px 0 32px rgba(0,0,0,0.10);
  }
  .detail-collapse-tab { display: flex; }
}

/* =========== CITY LEGEND =========== */
.city-legend {
  position: absolute;
  bottom: 80px;
  left: 16px;
  z-index: 500;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: opacity 0.2s;
}
.city-legend.hidden { display: none; }
.city-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.city-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.city-legend-name { line-height: 1; }

/* =========== RESPONSIVE / MOBILE =========== */
.sheet-handle { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding-top: 0; height: 100vh; }
  .map-wrap { height: 100vh; }
  #map { height: 100vh; }
  .sidebar { display: none; }
  .detail { width: 100%; height: 85vh; top: auto; bottom: 0; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .detail.open { transform: translateY(0); }
  /* sidebar hidden → overlay anchors to viewport left edge */
  .map-overlay { left: 24px; max-width: calc(100vw - 48px); }
}

@media (max-width: 720px) {
  .app { padding-top: 0; }
  .map-wrap { height: 100vh; }
  #map { height: 100vh; }
  .detail { height: 85vh; top: auto; bottom: 0; border-radius: 20px 20px 0 0; }

  .map-overlay { display: none; }
  .legend { display: none; }
  .hint { display: none; }
  .leaflet-control-zoom { margin-right: 14px !important; margin-bottom: 220px !important; }
  .leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 30px !important; }

  /* Bottom sheet sidebar (3-snap) */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 100%;
    width: 100%;
    border-right: 0;
    border-top: 1px solid var(--rule);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.12);
    z-index: 850;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    will-change: transform;
    transform: translateY(calc(100% - 200px));
  }
  .sidebar.snap-collapsed { transform: translateY(calc(100% - 60px)); }
  .sidebar.snap-expanded  { transform: translateY(16px); }
  .sidebar.dragging       { transition: none !important; }
  .sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 10px;
    cursor: grab;
    flex-shrink: 0;
    background: white;
    z-index: 2;
    min-height: 56px;
    justify-content: center;
    touch-action: none;
  }
  .sheet-handle::before {
    content: ""; width: 40px; height: 4px;
    background: #D5D5D5; border-radius: 999px;
  }
  .sheet-handle .ttl {
    margin-top: 8px;
    font-size: 13px; font-weight: 700; color: var(--ink);
    display: flex; align-items: center; gap: 8px;
  }
  .sheet-handle .ttl .badge {
    background: var(--yellow); color: var(--ink);
    font-size: 10.5px; padding: 2px 8px;
    border-radius: 999px; font-weight: 700;
  }

  .hero { padding: 14px 20px 14px; display: none; }
  .sidebar.snap-expanded .hero { display: block; }
  .hero h1 { font-size: 20px; }
  .hero p { font-size: 12.5px; }
  .city-switch { flex-wrap: nowrap; gap: 5px; overflow-x: auto; }
  .city-switch button { padding: 6px 11px; font-size: 11.5px; }

  .filters { padding: 12px 20px; }

  /* 지도 위 플로팅 검색바 (JS로 이동 후 적용) */
  .map-wrap > .filters {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    z-index: 900;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--rule);
    padding: 10px 14px;
    gap: 8px;
  }

  .place { margin: 0 12px 5px; padding: 10px 14px; }
  .place-name { font-size: 15px; }
  .place-meta { font-size: 12px; }
  .swatch-pill { font-size: 10px; padding: 3px 8px; }
  .city-label { padding: 12px 20px 5px; }

  .detail { width: 100% !important; z-index: 1200; }
  .detail-head { padding: 18px 20px 14px; }
  .detail-name { font-size: 22px; }
  .detail-en { font-size: 12.5px; }
  .detail-desc { font-size: 13px; }
  .stat { padding: 14px 18px; }
  .stat .val { font-size: 18px; }
  .detail-body { padding: 20px 20px 80px; }
  .school-row { padding: 16px 16px 14px; font-size: 13px; }
  .school-row .sc-nm-left .nm-name { font-size: 16px; }
  .school-row .sc-tags { padding-left: 0; }
  .school-row .sc-tag + .sc-tag::before { display: none; }
  .sc-desc { margin-left: 0; }
  .consult-cta { padding: 14px 16px; flex-direction: column; align-items: stretch; gap: 10px; }
  .consult-cta .cta-mini { width: 100%; padding: 11px; }
}

/* ========== SCHOOL MAP MARKERS ========== */
.school-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.school-pin {
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border: 1.5px solid var(--ink);
}
.school-pin--sol {
  border: 2.5px solid #F59E0B;
  box-shadow: 0 2px 7px rgba(245,158,11,0.35);
}

/* ========== OFFICE MAP MARKERS (SOL) ========== */
.office-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.office-pin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
}
.office-pin .office-img {
  width: 44px !important;
  max-width: 44px !important;
  height: auto;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.45)) drop-shadow(0 1px 2px rgba(0,0,0,0.30));
  transition: filter .15s ease, transform .15s ease;
}
.office-pin:hover .office-img {
  filter: drop-shadow(0 5px 10px rgba(0,0,0,0.55)) drop-shadow(0 2px 4px rgba(0,0,0,0.35));
  transform: translateY(-2px);
}
.office-pin .stem {
  width: 2px;
  height: 8px;
  background: #111;
  margin-top: 0;
}
.office-pin .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFD400;
  border: 1.8px solid #111;
  margin-top: -2px;
}

.office-popup .leaflet-popup-content-wrapper {
  border-radius: 14px;
  padding: 2px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
}
.office-popup .leaflet-popup-content {
  margin: 12px 14px;
  font-family: 'Noto Sans KR', sans-serif;
}
.office-popup .op-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink, #111);
  margin-bottom: 2px;
}
.office-popup .op-sub {
  font-size: 11.5px;
  color: #666;
  margin-bottom: 10px;
}
.office-popup .op-actions {
  display: flex;
  gap: 6px;
}
.office-popup .op-btn {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.office-popup .op-btn.primary {
  background: #FFD400;
  color: #111;
  border-color: #111;
}
.office-popup .op-btn.primary:hover { background: #F4B400; }
.office-popup .op-btn.ghost {
  background: #fff;
  color: #333;
  border-color: #e5e5e5;
}
.office-popup .op-btn.ghost:hover { border-color: #999; }

/* ========== SCHOOL POPOVER (click-fixed) ========== */
.school-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 2px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}
.school-popup .leaflet-popup-content {
  margin: 10px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  min-width: 160px;
}
.school-popover .sp-name {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--ink, #111);
  line-height: 1.35;
}
.school-popover .sp-meta {
  font-size: 11.5px;
  color: #666;
  margin-top: 3px;
}
.school-popover .sp-sol-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: white;
  border: 1px solid var(--ink);
  padding: 5px 9px;
  border-radius: 6px;
  text-decoration: none;
  transition: all .15s ease;
}
.school-popover .sp-sol-link:hover {
  background: var(--ink);
  color: white;
}

/* ========== POI FACILITY POPUP (마트·병원·도서관·레저·공원) ========== */
.poi-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.poi-popup .leaflet-popup-content {
  margin: 10px 13px;
  font-family: 'Noto Sans KR', sans-serif;
  min-width: 170px;
}
.poi-popup .leaflet-popup-tip-container { display: none; }
.poi-popover .poi-name {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  line-height: 1.4;
}
.poi-popover .poi-name-ko {
  font-weight: 400;
  color: #555;
}
.poi-popover .poi-address {
  font-size: 11.5px;
  color: #666;
  margin-top: 4px;
  line-height: 1.45;
}
.poi-popover .poi-gmaps-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1a73e8;
  background: #e8f0fe;
  padding: 4px 10px;
  border-radius: 5px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.poi-popover .poi-gmaps-btn:hover {
  background: #1a73e8;
  color: #fff;
}

/* Demographics — dot-led vertical list */
.sc-demo {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding-left: 28px;
}
.demo-tag {
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  padding: 0 0 0 11px;
  border-radius: 0;
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.55;
  letter-spacing: 0.005em;
}
.demo-tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--demo-c, var(--ink-3));
  opacity: 0.85;
}
.demo-tag .demo-label {
  color: var(--ink-2);
}
.demo-tag .demo-val {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
}
.demo-tag--lead .demo-label {
  color: var(--ink);
  font-weight: 600;
}
.demo-tag--lead::before {
  width: 6px;
  height: 6px;
  top: calc(0.55em - 0.5px);
  opacity: 1;
}

.sc-show-all-btn {
  background: none;
  border: none;
  padding: 0 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  vertical-align: middle;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sc-show-all-btn:hover { color: var(--ink); }

.sc-demo-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 10px 0 6px;
  padding: 2px 0;
}
.sc-demo-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 6px;
  border-radius: 5px;
  overflow: hidden;
}
.sc-demo-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%);
  background: var(--bar-c, #ccc);
  opacity: 0.08;
  border-radius: 5px;
  z-index: 0;
  animation: barExpand 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.sc-demo-row--lead {
  background: rgba(254, 205, 8, 0.10);
  border-radius: 6px;
}
.sc-demo-row--lead::before { opacity: 0.14; }
.sc-demo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.sc-demo-row--lead .sc-demo-dot {
  width: 7px;
  height: 7px;
}
.sc-demo-label {
  flex: 1;
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.sc-demo-row--lead .sc-demo-label {
  color: var(--ink);
  font-weight: 600;
}
.sc-demo-val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
  min-width: 42px;
  text-align: right;
  position: relative;
  z-index: 1;
}
.sc-demo-row--lead .sc-demo-val {
  color: #8a5c00;
}

/* ── School card & demographics entrance animations ── */
@keyframes schoolCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes demoRowIn {
  from { opacity: 0; transform: translateX(-5px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes barExpand {
  from { width: 0; }
  to   { width: var(--pct, 0%); }
}

/* School row stagger — --anim-offset injected by JS (0s if panel open, 0.32s if first open) */
.school-row {
  animation: schoolCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--anim-offset, 0s);
}
.school-row:nth-child(2)   { animation-delay: calc(var(--anim-offset, 0s) + 0.05s); }
.school-row:nth-child(3)   { animation-delay: calc(var(--anim-offset, 0s) + 0.10s); }
.school-row:nth-child(4)   { animation-delay: calc(var(--anim-offset, 0s) + 0.15s); }
.school-row:nth-child(5)   { animation-delay: calc(var(--anim-offset, 0s) + 0.20s); }
.school-row:nth-child(6)   { animation-delay: calc(var(--anim-offset, 0s) + 0.24s); }
.school-row:nth-child(7)   { animation-delay: calc(var(--anim-offset, 0s) + 0.28s); }
.school-row:nth-child(8)   { animation-delay: calc(var(--anim-offset, 0s) + 0.32s); }
.school-row:nth-child(n+9) { animation-delay: calc(var(--anim-offset, 0s) + 0.36s); }

/* Demo row stagger */
.sc-demo-row {
  animation: demoRowIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sc-demo-row:nth-child(1) { animation-delay: calc(var(--anim-offset, 0s) + 0.22s); }
.sc-demo-row:nth-child(2) { animation-delay: calc(var(--anim-offset, 0s) + 0.30s); }
.sc-demo-row:nth-child(3) { animation-delay: calc(var(--anim-offset, 0s) + 0.38s); }
.sc-demo-row:nth-child(4) { animation-delay: calc(var(--anim-offset, 0s) + 0.46s); }
.sc-demo-row:nth-child(5) { animation-delay: calc(var(--anim-offset, 0s) + 0.54s); }

/* Bar fill stagger */
.sc-demo-row:nth-child(1)::before { animation-delay: calc(var(--anim-offset, 0s) + 0.28s); }
.sc-demo-row:nth-child(2)::before { animation-delay: calc(var(--anim-offset, 0s) + 0.36s); }
.sc-demo-row:nth-child(3)::before { animation-delay: calc(var(--anim-offset, 0s) + 0.44s); }
.sc-demo-row:nth-child(4)::before { animation-delay: calc(var(--anim-offset, 0s) + 0.52s); }
.sc-demo-row:nth-child(5)::before { animation-delay: calc(var(--anim-offset, 0s) + 0.60s); }

.suburb-label {
  font-size: 10px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 3px white, 0 0 3px white, 0 0 3px white;
  opacity: 0.9;
}

/* ============================================================
   MOBILE UX BOOST (v2)
   - 상세 패널 3-스냅 (PEEK / HALF / FULL)
   - 상단 검색바 하단 도시 chips + 한인 토글
   - 검색바 우측 ⓘ → 레전드 바텀시트
   - FULL 전용 스티키 상담 CTA
   - 모바일 backdrop 비활성 (지도 인터랙션 우선)
   ============================================================ */

/* Defaults — 데스크톱에서는 모바일 전용 요소 숨김 */
.detail-handle,
.detail-back,
.detail-peek-bar,
.detail-sticky-cta,
.top-chips,
.legend-trigger,
.legend-sheet,
.legend-backdrop,
.mobile-card,
.mobile-city-field { display: none; }

@media (max-width: 720px) {
  /* === 중복 위젯 숨김 (top-chips로 대체) === */
  .hero .city-switch { display: none; }
  .hero .toggle-row { display: none; }
  .filters { padding-bottom: 6px; }
  .hero .count { display: none; }

  /* === 모바일 재구성: 지역 리스트(사이드바) 숨김 — 지도 핀으로 지역 선택 === */
  .sidebar { display: none !important; }

  /* === 모바일: 학교 찾기 가이드(검색 조건)를 지도 상단 플로팅 카드로 === */
  .map-wrap > #guidePanel {
    display: flex !important;
    position: fixed;
    top: calc(max(10px, env(safe-area-inset-top)) + 52px);
    left: 12px; right: 12px;
    z-index: 740;
    margin: 0;
    padding: 10px 14px 12px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(8px);
    border: 1px solid var(--rule);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    gap: 9px;
    max-height: calc(100vh - 300px);
  }
  /* 도시는 상단 chips(#topChips)가 담당 → 가이드 패널에선 숨김 */
  .map-wrap > #guidePanel #gpCityField,
  .map-wrap > #guidePanel .gp-city-label { display: none; }
  /* 칩 줄을 가로 스크롤 1줄로 — 세로 공간 절약 */
  .map-wrap > #guidePanel .gp-chips {
    flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .map-wrap > #guidePanel .gp-chips::-webkit-scrollbar { display: none; }
  .map-wrap > #guidePanel .gp-result { padding-top: 8px; }

  /* === 검색바 안 ⓘ 버튼 + 조회 버튼 숨김 + 좌표 보정 === */
  .map-wrap .search .legend-trigger {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 6px; z-index: 4;
    width: 32px; height: 32px;
    background: var(--bg-soft); border: 0; border-radius: 50%;
    color: var(--ink); font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    padding: 0;
  }
  .map-wrap .search .legend-trigger:active { background: var(--rule); }
  .map-wrap .search .search-btn { display: none; }
  .map-wrap .search .search-clear { right: 44px; }
  .map-wrap .search input { padding-right: 48px; }

  /* === 도시 chips + 한인 토글 (검색바 아래 floating) === */
  .top-chips {
    display: flex;
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: 0; right: 0;
    z-index: 715;
    padding: 6px 12px 4px;
    gap: 6px; align-items: center;
    overflow-x: auto; overflow-y: visible;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    transition: opacity .25s, transform .25s;
  }
  .top-chips::-webkit-scrollbar { display: none; }
  .top-chips .chip {
    flex-shrink: 0;
    background: white;
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 12.5px; font-weight: 700;
    color: var(--ink-2); cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    white-space: nowrap;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
  }
  .top-chips .chip:active { transform: scale(0.95); }
  .top-chips .chip.active {
    background: var(--yellow); color: var(--ink); border-color: var(--yellow-soft);
  }
  .top-chips .divider {
    width: 1px; height: 22px; background: var(--rule);
    flex-shrink: 0; margin: 0 2px;
  }
  /* POI 칩: 흰 알약 + 라인 아이콘 + 한글 라벨 (목업 스펙) */
  .top-chips .toggle-chip {
    flex-shrink: 0;
    height: 32px; padding: 0 12px;
    background: white; border: 1px solid #cdd0d3;
    border-radius: 30px;
    font-size: 14px; font-weight: 500; color: var(--ink);
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; box-shadow: none;
    font-family: inherit;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
  }
  .top-chips .toggle-chip:active { transform: scale(0.96); }
  .top-chips .toggle-chip .chip-ico {
    flex-shrink: 0; color: var(--ink-2);
    transition: color .15s;
  }
  .top-chips .toggle-chip .chip-label { line-height: 1; }
  /* 활성(ON): 노란 강조 (목업 톤 통일) */
  .top-chips .toggle-chip.on {
    background: var(--yellow); border-color: var(--yellow-soft); color: var(--ink);
  }
  .top-chips .toggle-chip.on .chip-ico { color: var(--ink); }

  /* 모바일: 마트 필터 패널을 top-chips 바로 아래로 */
  .mart-filter-panel {
    top: calc(max(16px, env(safe-area-inset-top)) + 56px + 4px + 44px);
    left: 12px; right: 12px;
    max-width: none;
    z-index: 716;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(8px);
  }
  /* 상세 열렸을 때 마트 필터도 함께 fade out */
  body:has(.detail.open) .mart-filter-panel {
    opacity: 0; pointer-events: none; transform: translateY(-8px); transition: all .25s;
  }

  /* 데스크톱 .mart-toggle은 모바일에서 숨김 (top-chips로 대체) */
  .map-overlay .mart-toggle { display: none; }

  /* 상세 열렸을 때 검색·chips fade out (지도/패널 우선) */
  body:has(.detail.open) .map-wrap .filters,
  body:has(.detail.open) .top-chips {
    opacity: 0; pointer-events: none; transform: translateY(-8px); transition: all .25s;
  }

  /* === 상세 패널 3-스냅 === */
  .detail {
    height: 88vh;
    top: auto; bottom: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.32,.72,0,1);
    z-index: 1200;
    overflow: hidden;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  }
  .detail.open { transform: translateY(calc(100% - 180px)); }              /* PEEK */
  .detail.open.snap-half { transform: translateY(calc(100% - 50vh)); }
  .detail.open.snap-full { transform: translateY(8%); }
  .detail.dragging { transition: none !important; }

  /* 모바일: 새 헤더 바 숨김 (drag handle + peek-bar로 대체) */
  .detail-top-bar { display: none; }

  /* 드래그 핸들 */
  .detail-handle {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 10px 0 6px; min-height: 30px;
    cursor: grab; touch-action: none; flex-shrink: 0;
    background: white; z-index: 2;
    position: relative;
  }
  .detail-handle::before {
    content: ""; width: 40px; height: 4px;
    background: #D5D5D5; border-radius: 999px;
  }

  /* 뒤로가기 버튼 — 핸들 영역 좌측 absolute, 모든 스냅에서 보임 */
  .detail-back {
    display: flex; align-items: center; justify-content: center;
    position: absolute;
    top: 6px; left: 12px;
    width: 36px; height: 36px;
    background: var(--bg-soft); border: 0; border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
    z-index: 5;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: background .15s;
  }
  .detail-back:active { background: var(--rule); transform: scale(0.95); }
  .detail-back svg { display: block; }

  /* PEEK 한 줄 헤더 — PEEK 상태에서만 보임 (HALF/FULL에선 cover/head로 정보 제공) */
  .detail-peek-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 18px 14px 56px; flex-shrink: 0;
  }
  /* HALF / FULL에서는 PEEK bar 숨김 (head/stats가 그 역할) */
  .detail.snap-half .detail-peek-bar,
  .detail.snap-full .detail-peek-bar { display: none; }
  .detail-peek-bar .meta { flex: 1; min-width: 0; }
  .detail-peek-bar .region {
    font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
    color: var(--ink-3); text-transform: uppercase;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .detail-peek-bar .name {
    font-size: 19px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.25;
    margin-top: 2px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }
  .detail-peek-bar .name .ko-tag {
    font-size: 9.5px; padding: 2px 6px;
  }
  .detail-peek-bar .rent-chip {
    background: var(--yellow-bg); color: var(--ink);
    padding: 9px 13px; border-radius: 999px;
    font-weight: 800; font-size: 13px; flex-shrink: 0;
    border: 1px solid #F2D77A; white-space: nowrap;
  }

  /* 상태별 콘텐츠 가시성 — display 기반으로 처리해 PEEK에서 detail-body가 위로 올라오도록 */
  .detail .detail-head,
  .detail .detail-stats,
  .detail .rent-source { display: none; }

  /* HALF: head / stats / rent-source 노출 */
  .detail.snap-half .detail-head,
  .detail.snap-half .rent-source,
  .detail.snap-full .detail-head,
  .detail.snap-full .rent-source { display: block; }
  .detail.snap-half .detail-stats,
  .detail.snap-full .detail-stats { display: grid; }

  /* detail-body(학교 디렉토리 포함)는 모든 스냅에서 가시 — PEEK에서도 학교 리스트 미리보기 */
  /* Restore flex:1 + overflow-y:auto so school list scrolls independently within the
     fixed-height drag panel (overridden from desktop's whole-panel-scroll layout). */
  .detail .detail-body {
    opacity: 1; pointer-events: auto;
    flex: 1;
    overflow-y: auto;
  }

  /* Close 버튼 FULL에서만 */
  .detail .detail-close {
    opacity: 0; pointer-events: none; transition: opacity .25s;
    width: 40px; height: 40px;
  }
  .detail.snap-full .detail-close { opacity: 1; pointer-events: auto; }

  /* 학교 헤더 안의 닫기 버튼은 모바일에선 숨김 (좌상단 뒤로가기 버튼으로 대체) */
  .detail .section-label .detail-close { display: none; }

  /* Head 상단 패딩 — peek-bar가 위에 있으므로 살짝 줄임 */
  .detail .detail-head { padding-top: 14px; }

  /* 본문 상담 카드는 모바일에서 중복이므로 숨김 — sticky CTA로 통일 */
  .detail .consult-cta { display: none; }

  /* 스티키 상담 CTA — HALF / FULL에서 노출 */
  .detail-sticky-cta {
    display: none;
    position: sticky; bottom: 0;
    margin: 0 -20px -20px;
    padding: 10px 20px max(14px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, white 70%, rgba(255,255,255,0));
    z-index: 5;
  }
  .detail.snap-half .detail-sticky-cta,
  .detail.snap-full .detail-sticky-cta { display: block; }
  .detail-sticky-cta a {
    display: block; text-align: center;
    background: var(--ink); color: var(--yellow);
    padding: 14px; border-radius: 999px;
    font-weight: 800; font-size: 14px; text-decoration: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  }
  /* CTA가 콘텐츠 가리지 않도록 body 하단 여백 보강 */
  .detail-body { padding-bottom: 90px; }


  /* === 레전드 바텀시트 === */
  .legend-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1280;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .legend-backdrop.show { opacity: 1; pointer-events: auto; }
  .legend-sheet {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 1300;
    padding: 12px 20px max(20px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
    max-height: 70vh; overflow-y: auto;
  }
  .legend-sheet.open { transform: translateY(0); }
  .legend-sheet::before {
    content: ""; display: block; margin: 0 auto 10px;
    width: 40px; height: 4px; background: #D5D5D5; border-radius: 999px;
  }
  .legend-sheet h3 {
    margin: 0 0 4px; font-size: 16px; font-weight: 800; color: var(--ink);
  }
  .legend-sheet .sub {
    font-size: 12px; color: var(--ink-3); margin: 0 0 14px;
  }
  .legend-sheet h4 {
    font-size: 11px; font-weight: 700; color: var(--ink-3);
    text-transform: uppercase; letter-spacing: .06em;
    margin: 14px 0 8px;
  }
  .legend-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  }
  .legend-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--ink-2); font-weight: 600;
  }
  .legend-row .dot {
    width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid white; box-shadow: 0 0 0 1px var(--rule);
  }

  /* === 줌 컨트롤 위치 보정 === */
  .leaflet-control-zoom { margin-bottom: 210px !important; }
  /* 상세 열렸을 땐 줌이 상세 PEEK 위로 — same 200px 정도 */
  body:has(.detail.open) .leaflet-control-zoom {
    margin-bottom: 200px !important;
  }

  /* ============================================================
     모바일 전용 재설계 (목업 기반)
     - 좌측 필터/지역 리스트/3-snap 드로어 제거
     - 상단: 도시 드롭다운(검색바) + POI 칩 줄
     - 하단: 학교/POI 단일 정보 카드
     ============================================================ */

  /* 기존 무거운 UI 제거 (목업엔 필터/지역리스트/드로어 없음) */
  .detail { display: none !important; }
  .map-wrap > #guidePanel { display: none !important; }

  /* === 검색바(map-overlay) 모바일 재노출 — 상단 고정 === */
  .map-overlay {
    display: flex !important;
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: 12px; right: 12px;
    max-width: none;
    z-index: 800;
    margin: 0;
  }
  .map-overlay .search { width: 100%; flex: 1; }
  .map-overlay .cat-btns { display: none; }  /* 데스크톱 POI 버튼 숨김 (top-chips로 대체) */

  /* POI 칩 줄(top-chips)을 검색바 아래로 */
  .top-chips {
    top: calc(max(10px, env(safe-area-inset-top)) + 56px);
  }
  /* top-chips: 도시 칩·divider 숨기고 POI 토글만 칩 줄로 유지 */
  .top-chips .chip,
  .top-chips .divider { display: none !important; }

  /* === 검색바: 흰 알약 컨테이너 (목업 스펙) === */
  .map-wrap .search {
    display: flex; align-items: center;
    height: 48px; padding: 0 8px;
    background: #fff;
    border: 1px solid #cdd0d3;
    border-radius: 50px;
    box-shadow: 0 1px 2px rgba(10,13,18,0.05);
  }
  .map-wrap .search input {
    order: 2; flex: 1; width: auto; min-width: 0; height: 100%;
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    padding: 0 8px;
    font-size: 15px; color: var(--ink);
  }
  .map-wrap .search input::placeholder { color: var(--ink-3); }
  /* 좌측 절대배치 돋보기 → 우측 정적배치로 이동 (목업: 우측 🔍) */
  .map-wrap .search .search-icon {
    display: block; position: static; order: 5;
    width: 20px; height: 20px; margin: 0 4px 0 2px;
    color: var(--ink-3); flex-shrink: 0;
  }
  .map-wrap .search .legend-trigger { display: none !important; }  /* 모바일 ⓘ 숨김 */
  .map-wrap .search .search-btn { display: none; }
  .map-wrap .search .search-clear {
    order: 4; position: static; right: auto; margin: 0 2px;
  }

  /* 도시 커스텀 드롭다운 (검색바 내부 좌측) */
  .mobile-city-field {
    display: inline-flex; align-items: center;
    order: 1; position: relative; flex-shrink: 0;
    margin-right: 6px;
  }
  .mobile-city-btn {
    display: inline-flex; align-items: center; gap: 5px;
    height: 34px; padding: 0 9px 0 13px;
    background: #f1f2f4; border: 0; border-radius: 999px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    letter-spacing: -0.01em; color: var(--ink);
    cursor: pointer; white-space: nowrap;
    transition: background .18s ease, transform .12s ease;
  }
  .mobile-city-btn:active { transform: scale(0.97); background: #e8eaed; }
  .mobile-city-field.open .mobile-city-btn { background: #e8eaed; }
  .mobile-city-label { line-height: 1; }
  .mobile-city-caret {
    color: var(--ink-3); flex-shrink: 0;
    transition: transform .22s cubic-bezier(.4,0,.2,1);
  }
  .mobile-city-field.open .mobile-city-caret { transform: rotate(180deg); }

  /* 드롭다운 메뉴 — 부드러운 fade + slide */
  .mobile-city-menu {
    position: absolute; top: calc(100% + 8px); left: 0;
    min-width: 160px;
    background: #fff; border-radius: 16px;
    padding: 6px;
    box-shadow: 0 12px 32px rgba(16,22,30,0.16), 0 2px 8px rgba(16,22,30,0.08);
    border: 1px solid rgba(16,22,30,0.06);
    display: flex; flex-direction: column; gap: 2px;
    opacity: 0; transform: translateY(-8px) scale(0.98);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity .2s ease, transform .22s cubic-bezier(.34,1.4,.5,1);
    z-index: 900;
  }
  .mobile-city-field.open .mobile-city-menu {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  .mobile-city-opt {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 42px; padding: 0 12px 0 14px;
    background: transparent; border: 0; border-radius: 11px;
    font-family: inherit; font-size: 14.5px; font-weight: 600;
    color: var(--ink-2); cursor: pointer; text-align: left;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease;
  }
  .mobile-city-opt:active { background: #f1f2f4; }
  .mobile-city-opt.is-selected {
    background: var(--yellow-bg); color: var(--ink); font-weight: 700;
  }
  /* 선택 표시(체크) */
  .mobile-city-opt.is-selected::after {
    content: ""; width: 16px; height: 16px; flex-shrink: 0; margin-left: 10px;
    background: no-repeat center/contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E5B600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  }

  /* === 모바일 하단 정보 카드 === */
  .mobile-card {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1200;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.16);
    transform: translateY(115%);
    transition: transform .38s cubic-bezier(.32,.72,0,1);
    max-height: 72vh; overflow: visible;   /* 둥근 모서리에 X가 잘리지 않도록 */
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .mobile-card.open { transform: translateY(0); }
  /* 닫기 X — 디자인 스펙: 24×24 깔끔한 진한 ×, 배경/그림자 없음, 패딩 16/6 */
  .mc-close {
    position: absolute; top: 10px; right: 16px; z-index: 3;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 4px;
    color: var(--ink); cursor: pointer; padding: 0;
    box-shadow: none;
    transition: transform .1s;
  }
  .mc-close svg { width: 24px; height: 24px; stroke-width: 2; }
  .mc-close:active { transform: scale(0.9); }
  .mc-body {
    padding: 44px 12px 14px;   /* 상단 X 헤더 공간(패딩10+X24+gap10) + 카드 인셋 */
    max-height: 72vh; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 내용 전체를 감싸는 테두리 카드 (목업 스펙: border 1px #cdd0d3, radius 8px) */
  .mc-school, .mc-poi {
    background: #fff;
    border: 1px solid #cdd0d3;
    border-radius: 8px;
    padding: 14px;
  }

  /* 카드 헤더: 제목 + CTA */
  .mc-head {
    display: flex; align-items: flex-start; gap: 10px;
  }
  .mc-title { flex: 1; min-width: 0; }
  .mc-name {
    font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
    line-height: 1.3; color: var(--ink);
  }
  .mc-name-ko {
    font-size: 12.5px; font-weight: 600; color: var(--ink-3);
    margin-top: 3px;
  }
  .mc-cta {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 13px; border-radius: 999px;
    background: var(--bg-soft); color: var(--ink);
    font-size: 12px; font-weight: 800; text-decoration: none;
    white-space: nowrap;
    transition: background .15s, transform .1s;
  }
  .mc-cta:active { transform: scale(0.95); }
  .mc-cta--sol { background: var(--yellow); color: var(--ink); }
  .mc-cta svg { display: block; }

  /* POI '자세히 보기' — 밑줄 텍스트 링크 (목표 preview 스펙: 12px/500) */
  .mc-link {
    flex-shrink: 0; align-self: center;
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--ink); font-size: 12px; font-weight: 500;
    text-decoration: underline; text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    white-space: nowrap;
    transition: opacity .15s;
  }
  .mc-link:active { opacity: 0.6; }
  .mc-link svg { display: block; width: 15px; height: 15px; }

  /* 태그 칩 (카드 전용 — .school-row 스코프 밖이라 직접 스타일) */
  .mc-tags {
    display: flex; flex-wrap: wrap; gap: 5px;
    margin-top: 12px; margin-bottom: 0;
  }
  .mc-tags .sc-tag {
    display: inline-flex; align-items: center;
    height: 26px; padding: 0 11px;
    background: #fff; border: 1px solid #cdd0d3;
    border-radius: 30px;
    font-size: 12px; font-weight: 500; color: var(--ink);
    white-space: nowrap;
  }
  .mc-tags .sc-tag::before { display: none; }

  /* 설명문 — PC처럼 회색 박스 (목업 스펙: #f2f2f2, radius 6px) */
  .mc-desc-box {
    margin-top: 14px;
    background: #f2f2f2; border-radius: 6px;
    padding: 11px 12px;
  }
  .mc-desc {
    margin: 0;
    font-size: 13px; line-height: 1.65; color: var(--ink);
  }

  /* 민족 구성 — PC 색상 칩 (.sc-demo-chip[data-eth] 전역 스타일 사용) */
  /* .sc-demo-inline(전역, 더 뒤)이 margin-top:0으로 덮어쓰므로 명시도를 높여 간격 보장 (목업 spec: 10px) */
  .mc-school .mc-demo { margin-top: 10px; }
  .mc-demo .sc-demo-chip { font-size: 11.5px; height: 22px; padding: 0 10px; }

  /* POI 카드 주소 */
  .mc-poi-addr {
    margin-top: 14px; padding: 11px 13px;
    background: var(--bg-soft); border-radius: 12px;
    font-size: 12.5px; line-height: 1.5; color: var(--ink-2);
  }

  /* 카드가 열려도 상단 검색바 + POI 칩 줄은 항상 노출 (사용자 요청) */
  /* 카드 열렸을 때 상담 FAB 숨김 (카드와 겹침 방지) */
  body:has(.mobile-card.open) #consultFab {
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
}

/* ── SOL badge (brand yellow chip) ─────────────────────── */
.sol-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 26px;
  padding: 0 10px;
  border-radius: 30px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .18s;
}
.sol-badge::before {
  content: none;
}
.sol-badge:hover,
.sol-badge:focus-visible {
  background: var(--yellow-soft);
  color: var(--ink);
  transform: translateY(-1px);
}
.sol-badge:hover::before,
.sol-badge:focus-visible::before {
  color: var(--ink);
}
.sol-badge-arrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

/* SOL-matched row: no left line (SOL badge in header already indicates it) */
.school-row[data-has-sol="1"] {
  position: relative;
}
.school-row[data-has-sol="1"]::before {
  content: none;
}

@media (max-width: 640px) {
  .sol-badge {
    padding: 5px 12px;
    font-size: 11.5px;
  }
}

/* ── School desc (popup + detail card) ── */
/* 학교 마커 팝업 내 설명 */
.sp-desc {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  white-space: pre-wrap;
  max-width: 260px;
}

/* 학교 팝업 하이라이트 박스 (노란색) — 인종 정보 위에 표시 */
.sp-highlight-box {
  margin-top: 6px;
  padding: 5px 9px;
  background: #FFF8C5;
  border: 1px solid #F2D77A;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  color: #7a5a00;
  white-space: pre-wrap;
  max-width: 260px;
}

/* ── 인종 비율 인라인 칩 (컬러 텍스트) ── */
.sc-demo-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0;
}
.sc-demo-chip {
  font-size: 11px;
  font-weight: 500;
  height: 20px;
  padding: 0 9px;
  border-radius: 30px;
  background: var(--bg-soft);
  border: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.sc-demo-chip[data-eth="european"]     { background: var(--eth-blue); }
.sc-demo-chip[data-eth="asian"]        { background: var(--eth-peach); }
.sc-demo-chip[data-eth="maori"]        { background: var(--eth-green); }
.sc-demo-chip[data-eth="pacific"]      { background: #FFF3E0; }
.sc-demo-chip[data-eth="other"]        { background: var(--eth-lav); }
.sc-demo-chip[data-eth="melaa"]        { background: var(--eth-lav); }
.sc-demo-chip[data-eth="international"]{ background: var(--bg-soft); }

/* ── 검색 키워드 하이라이트 ── */
mark.search-mark {
  background: #FFE066;
  color: #5a3e00;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
  /* 브라우저 기본 mark 스타일 초기화 */
  text-decoration: none;
}

/* ══════════════════════════════════════════
   리스트 정렬·필터 바 (컴팩트 바 + 드롭다운)
   ══════════════════════════════════════════ */
.list-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--rule);
  background: white;
  position: relative;
  flex-shrink: 0;
  min-width: 0;
}
.lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.lb-btn:hover {
  background: var(--bg-soft);
  border-color: var(--rule);
}
.lb-btn[aria-expanded="true"] {
  background: var(--yellow-bg);
  border-color: rgba(254,205,8,.45);
  color: var(--ink);
}
.lb-btn[aria-expanded="true"] .lb-chev {
  transform: rotate(180deg);
}
.lb-chev { transition: transform .2s ease; flex-shrink: 0; }
.lb-divider {
  width: 1px;
  height: 16px;
  background: var(--rule);
  margin: 0 4px;
  flex-shrink: 0;
}
.lb-filter-btn { margin-left: auto; }
.lb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--yellow);
  color: #3d2f00;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
}
.lb-badge:empty { display: none; }

/* 드롭다운 패널 */
.lb-drop {
  position: absolute;
  top: calc(100% + 4px);
  background: white;
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  padding: 10px 0 8px;
  min-width: 190px;
  z-index: 800;
  animation: lbDropIn .15s ease;
}
@keyframes lbDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lb-sort-drop { left: 14px; }
.lb-filter-drop { right: 14px; }
.lb-drop-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 14px 8px;
}
.lb-radio,
.lb-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background .12s ease;
  border-radius: 0;
}
.lb-radio:hover,
.lb-check:hover { background: var(--bg-soft); }
.lb-radio input,
.lb-check input { accent-color: var(--yellow); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.lb-drop-actions {
  border-top: 1px solid var(--rule-soft);
  margin-top: 6px;
  padding: 8px 14px 0;
}
.lb-reset {
  background: none;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
}
.lb-reset:hover { color: var(--ink); }

/* 모바일: 리스트 바 살짝 더 컴팩트 */
@media (max-width: 900px) {
  .list-bar { padding: 4px 12px; }
  .lb-btn { font-size: 12px; padding: 4px 8px; }
}

/* ══════════════════════════════════════════
   Narrow sidebar — tighter spacing via container query
   (responds to sidebar's own width, not viewport)
   ══════════════════════════════════════════ */
.sidebar { container-type: inline-size; container-name: sidebar; }
@container sidebar (max-width: 380px) {
  /* guide-panel 패딩은 각 섹션이 자체 관리 — 여기서 override 하지 않음 */
  .list-bar { padding: 5px 12px; gap: 4px; }
  .lb-btn { padding: 4px 8px; }
}
@container sidebar (max-width: 320px) {
  .list-bar .gp-result { font-size: 11px; }
}

/* ── 가이드 인트로: .gp-section 패딩 사용 (별도 패딩 없음) ── */
/* STEP 1 — .gp-section 패딩으로 처리 */
.gp-city-label { margin-bottom: 12px; }
.gp-city-row { display: flex; align-items: center; }
.gp-city-row .city-switch { flex: 1; min-width: 0; }

/* STEP 2 — .gp-section 패딩으로 처리 */
.gp-filter-section-label { margin-bottom: 12px; }

/* 필터 박스 — 테두리 없음, 섹션 내 플로우 */
.gp-filter-box { margin: 0; border: none; padding: 0; background: transparent; }

/* 필터 헤더 행: 좌측 라벨 | 우측 초기화+쉐브론 */
.gp-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
}
.gp-filter-label-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.gp-filter-label-text { font-size: 14px; font-weight: 500; color: var(--ink); }
.gp-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.gp-filter-chevron-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--ink-3);
  transition: color .15s;
}
.gp-filter-chevron-btn:hover { color: var(--ink); }
.gp-filter-chevron {
  flex-shrink: 0;
  transition: transform .2s ease;
  display: block;
}
.gp-filter-chevron-btn[aria-expanded="true"] .gp-filter-chevron {
  transform: rotate(180deg);
}

/* .gp-filter-btn — 이제 chevron 전용 버튼 (.gp-filter-chevron-btn) */
.gp-filter-btn-left { display: inline-flex; align-items: center; gap: 6px; }
.gp-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  background: var(--yellow);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  line-height: 1;
}
.gp-filter-badge:empty { display: none; }

/* ── 확장 필터 패널 ── */
.gp-filter-panel[hidden] { display: none; }
.gp-filter-panel { overflow: hidden; }
.gp-filter-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 10px;
  animation: gpPanelIn .18s ease;
}
@keyframes gpPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gp-field--row { flex-direction: row; align-items: center; }
.gp-check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.gp-check-label input { accent-color: var(--yellow); width: 15px; height: 15px; cursor: pointer; }

.gp-filter-reset {
  background: none;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  transition: color .12s;
}
.gp-filter-reset:hover { color: var(--ink); }

/* ── 렌트 히스토그램 + 듀얼 슬라이더 ── */
.lb-filter-drop { min-width: 270px; }
.lb-drop-sub { font-weight: 400; color: var(--ink-3); letter-spacing: 0; text-transform: none; font-size: 10px; }
.lb-drop-title--sm { padding-top: 2px; }
.lb-drop-rule { border: none; border-top: 1px solid var(--rule-soft); margin: 8px 0 4px; }

.lb-rent-wrap { padding: 0 14px 4px; }

.lb-rent-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.lb-rent-label-row b { color: var(--ink); font-weight: 700; }

/* 실시간 가격 라벨 */
.gp-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gp-label-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--gold-text);
  letter-spacing: -0.01em;
}

.lb-hist-wrap { display: none; }
.lb-hist-canvas { display: none; }
.lb-hist-axis { display: flex; justify-content: space-between; font-size: 11px; font-weight: 400; color: var(--ink-3); padding: 0 2px; }

/* 입체 툴팁 — 캔버스 내부 오버레이 */
.hist-tooltip {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%) scale(0.88);
  background: rgba(20, 32, 54, 0.93);
  color: #fff;
  border-radius: 8px;
  padding: 4px 9px 3px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease, left 0.06s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 4px 14px rgba(0,0,0,0.55),
    0 1px 4px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.08);
}
.hist-tooltip.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.hist-tooltip .ht-range {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15px;
  color: #8dc4f0;
  display: block;
  line-height: 1.3;
}
.hist-tooltip .ht-count {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}
.hist-tooltip .ht-count em {
  font-style: normal;
  color: #5bc5a7;
}

/* 듀얼 슬라이더 트랙 */
.lb-dual-slider {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  margin-top: 0;
}
.lb-slider-track {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: var(--rule);
  border-radius: 99px;
  pointer-events: none;
}
.lb-slider-fill {
  position: absolute;
  height: 4px;
  background: var(--yellow);
  border-radius: 99px;
  top: 50%;
  transform: translateY(-50%);
}

/* range inputs — stacked on top of each other */
.lb-range {
  position: absolute;
  left: 0; right: 0;
  width: 100%;
  height: 24px;
  background: transparent;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  margin: 0;
}
.lb-range::-webkit-slider-thumb {
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--yellow);
  box-shadow: 0 2px 6px rgba(254, 205, 8, 0.28), 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: grab;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lb-range::-webkit-slider-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(254, 205, 8, 0.38), 0 2px 4px rgba(0, 0, 0, 0.15);
}
.lb-range::-webkit-slider-thumb:active {
  transform: scale(1.18);
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(254, 205, 8, 0.48), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.lb-range::-moz-range-thumb {
  pointer-events: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--yellow);
  box-shadow: 0 2px 6px rgba(254, 205, 8, 0.28), 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: grab;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lb-range::-moz-range-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(254, 205, 8, 0.38), 0 2px 4px rgba(0, 0, 0, 0.15);
}
.lb-range::-moz-range-thumb:active {
  transform: scale(1.18);
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(254, 205, 8, 0.48), 0 2px 6px rgba(0, 0, 0, 0.2);
}
/* ensure max thumb is on top when at max position */
#lbRentMax { z-index: 2; }
#lbRentMin { z-index: 3; }

/* Desktop-only adjustment: Add spacing at the top of the sidebar, map overlay, and right school detail panel when embedded or viewed on desktop to prevent overlapping with homepage sticky menus */
@media (min-width: 901px) {
  .sidebar .guide-panel,
  .sidebar .hero {
    padding-top: 20px !important;
  }
  .map-overlay {
    top: 18px !important;
  }
  .detail .detail-body {
    padding-top: 20px !important;
  }
  .detail .detail-head,
  .detail .detail-head--slim {
    padding-top: 20px !important;
  }
}

/* --- Floating Consultation Button Styling --- */
#consultFab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9999;
  display: block;
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
  transition: transform 0.15s ease, filter 0.15s ease;
}
#consultFab:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.35));
}

@media (max-width: 900px) {
  #consultFab {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
  }
}





