:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1b1f24;
  --muted: #68717d;
  --border: #e2e5ea;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn-soft: #fef3c7;
  --warn: #92400e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d212a;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --border: #2a2f3a;
    --accent: #5b8cff;
    --accent-soft: #1d2a4a;
    --orange: #fb923c;
    --orange-soft: #3a2412;
    --danger: #f87171;
    --danger-soft: #3b1a1a;
    --warn-soft: #3a2e0f;
    --warn: #fcd34d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1d212a;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --border: #2a2f3a;
  --accent: #5b8cff;
  --accent-soft: #1d2a4a;
  --orange: #fb923c;
  --orange-soft: #3a2412;
  --danger: #f87171;
  --danger-soft: #3b1a1a;
  --warn-soft: #3a2e0f;
  --warn: #fcd34d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner {
  max-width: 1400px; margin: 0 auto; padding: 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.top h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 13px; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { font-weight: 500; padding: 6px 10px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }

.toolbar { background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20; }
.toolbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 16px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0; }
.field input[type="number"], .field input[type="search"], .field select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; min-height: 36px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.gu-options { display: flex; flex-wrap: wrap; gap: 4px 16px; min-height: 36px; align-items: center; }
.gu-options label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.field-check { flex-direction: row; align-items: center; gap: 8px; min-height: 36px; }
.field-check > span { font-size: 13px; color: var(--text); font-weight: 500; }
.field-query { grid-column: span 2; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.banner {
  max-width: 1400px; margin: 12px auto 0; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-left: 16px; margin-right: 16px;
}
.banner.is-error { background: var(--danger-soft); color: var(--danger); }
.banner.is-warn { background: var(--warn-soft); color: var(--warn); }
.banner.is-info { background: var(--accent-soft); color: var(--accent); }

.content {
  max-width: 1400px; margin: 0 auto; padding: 12px 16px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
}
.results { min-width: 0; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.results-head h2 { font-size: 16px; font-weight: 700; }
.results-head h2 small { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }

.map-wrap { order: -1; }
.map { height: 42vh; min-height: 260px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }

.progress {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.progress-title { font-weight: 600; }
.progress-detail { color: var(--muted); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.list { display: flex; flex-direction: column; gap: 10px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); }
.card.is-selected { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 700; flex: 1 1 auto; min-width: 0; }
.card-floor { font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.card-floor.is-ambiguous { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.gu-1132000000 { background: var(--accent-soft); color: var(--accent); }
.badge.gu-1135000000 { background: var(--orange-soft); color: var(--orange); }
.card-price { margin-top: 6px; font-size: 15px; }
.card-price b { font-size: 17px; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-feature { margin: 8px 0 0; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.card-foot a { font-weight: 600; text-decoration: none; white-space: nowrap; }
.card-foot a:hover { text-decoration: underline; }

.leaflet-popup-content { font-size: 13px; line-height: 1.45; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 14px; }
.popup-link { display: inline-block; margin-top: 4px; font-weight: 600; }
.leaflet-container { font-family: inherit; }
:root[data-theme="dark"] .leaflet-tile, :root:not([data-theme="light"]) .leaflet-tile { filter: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-popup-content-wrapper, :root:not([data-theme="light"]) .leaflet-popup-tip { background: var(--surface); color: var(--text); }
}
:root[data-theme="dark"] .leaflet-popup-content-wrapper, :root[data-theme="dark"] .leaflet-popup-tip { background: var(--surface); color: var(--text); }

.foot { max-width: 1400px; margin: 0 auto; padding: 0 16px 28px; color: var(--muted); font-size: 12px; }

@media (min-width: 960px) {
  .toolbar { position: sticky; top: 0; }
  .content { grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); align-items: start; }
  .map-wrap { order: 0; position: sticky; top: calc(var(--toolbar-h, 120px) + 12px); }
  .map { height: calc(100vh - var(--toolbar-h, 120px) - 36px); min-height: 420px; }
}
@media (max-width: 600px) {
  .top-inner { padding: 12px 16px; }
  .top h1 { font-size: 18px; }
  .toolbar-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 10px 16px; }
  .field-gu, .field-query { grid-column: span 2; }
  .field-check { grid-column: span 2; min-height: 0; }
  .map { height: 38vh; }
}

.region-note { max-width:1400px; margin:12px auto; padding:0 16px; font-size:12px; color:var(--muted); }
.badge { white-space:normal; }

/* Calm, focused workspace */
:root[data-theme="light"] { --bg:#f5f5f7; --surface:#fff; --surface-2:#f5f5f7; --text:#1d1d1f; --muted:#6e6e73; --border:#e5e5e9; --accent:#0071e3; --radius:20px; --shadow:0 4px 20px #00000005; }
body { letter-spacing:-.025em; }
.top { background:var(--bg); border:0; }
.top-inner { max-width:1440px; padding:24px 32px; align-items:center; }
.wordmark { font-size:12px; font-weight:750; letter-spacing:.12em; margin-bottom:12px; }
.wordmark span { letter-spacing:-.02em; font-weight:500; color:var(--muted); border-left:1px solid var(--border); margin-left:12px; padding-left:12px; }
.top h1 { font-size:28px; letter-spacing:-.045em; font-weight:700; line-height:1.3; }
.sub { margin-top:10px; font-size:14px; }
.top-actions { flex-direction:column; align-items:flex-end; gap:10px; }
.status { font-size:11px; letter-spacing:0; }
.btn { min-height:40px; border-radius:12px; font-size:13px; background:#fff; padding:9px 14px; transition:background .15s, box-shadow .15s; }
.btn:hover { background:#f0f6fd; }
:focus-visible { outline:3px solid #0071e3; outline-offset:3px; }
.toolbar { background:#ffffffed; backdrop-filter:blur(20px); border-top:1px solid #e5e5e980; border-bottom:1px solid var(--border); }
.toolbar-inner { max-width:1440px; padding:18px 32px; }
.primary-filters { grid-template-columns:112px minmax(200px,280px) minmax(180px,1fr) 180px; align-items:end; gap:16px; }
.field-query { grid-column:auto; }
.field > span { margin-bottom:4px; font-size:11px; color:var(--muted); }
.field select,.field input[type="number"],.field input[type="search"] { box-sizing:border-box; border:1px solid #e5e5e9; background:#f5f5f7; height:48px; min-height:48px; padding:10px 12px; border-radius:11px; font-size:14px; line-height:22px; }
.field select { -webkit-appearance:none; appearance:none; padding-right:36px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; }
.field input[type="search"] { -webkit-appearance:none; appearance:none; }
#filterToggle { height:48px; background:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:5px 10px; line-height:18px; }
#filterSummary { display:block; font-size:10px; color:var(--muted); font-weight:400; }
.advanced-filters { max-width:1376px; margin:0 auto; padding:8px 0 22px; }
.filter-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.filter-heading h2 { font-size:14px; }
.filter-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:16px; }
.filter-grid .field-check { grid-column:1 / -1; }
.banner { max-width:1376px; margin:18px auto 4px; padding:12px 16px; font-size:12px; border-radius:12px; }
.banner.is-warn { background:#faf4e7; color:#795b24; border:1px solid #eee3ca; }
.content { max-width:1440px; padding:20px 32px 40px; gap:28px; }
.results-head { margin:0 0 18px; align-items:center; flex-wrap:wrap; }
.results-head h2 { font-size:20px; letter-spacing:-.04em; }
.results-head h2 small { display:block; margin:5px 0 0; font-size:11px; }
.result-actions { display:flex; gap:8px; align-items:center; }
.result-actions .field > span { display:none; }
.result-actions select { height:36px; min-height:36px; font-size:12px; background-color:transparent; padding:6px 32px 6px 10px; }
#btnFit { font-size:11px; padding:7px 10px; }
.view-switch { display:none; padding:3px; background:#e9e9ec; border-radius:10px; }
.view-switch button { background:transparent; border:0; border-radius:8px; padding:8px 16px; font-size:12px; cursor:pointer; }
.view-switch button.active { background:white; box-shadow:0 1px 4px #0002; }
.list { gap:16px; }
.card { padding:24px; border:1px solid #ececef; box-shadow:0 3px 16px #00000004; border-radius:20px; }
.card:hover { border-color:#b6cee6; box-shadow:0 6px 24px #00000009; }
.card-head { gap:8px; }
.card-head .badge { flex-basis:100%; padding:0; color:#637181; font-size:11px; font-weight:600; margin-bottom:7px; }
.card-title { font-size:18px; }
.card-floor { font-size:11px; padding:5px 9px; background:#f5f5f7; border:0; }
.card-price { margin-top:20px; font-size:12px; color:#6e6e73; }
.card-price b { font-size:23px; color:var(--text); font-weight:650; letter-spacing:-.04em; }
.card-meta { margin-top:8px; line-height:1.8; font-size:12px; }
.card-feature { font-size:13px; margin-top:14px; line-height:1.7; }
.card-tags { gap:5px; margin-top:12px; }
.tag { font-size:10px; border:0; padding:4px 8px; background:#f5f5f7; }
.card-foot { margin-top:18px; padding-top:14px; border-top:1px solid #f0f0f2; font-size:11px; line-height:1.6; }
.card-foot a { font-size:12px; }
.map-wrap { overflow:hidden; border-radius:22px; border:1px solid var(--border); box-shadow:var(--shadow); }
.map { border:0; border-radius:0; }
.region-note,.foot { max-width:1440px; padding-left:32px; padding-right:32px; font-size:11px; line-height:1.7; }
@media (min-width:960px) { .content { grid-template-columns:minmax(0,1fr) minmax(320px,43%); } .map-wrap { top:calc(var(--toolbar-h,100px) + 20px); } .map { height:calc(100dvh - var(--toolbar-h,100px) - 40px); min-height:320px; max-height:800px; } }
@media (max-width:1439px) { .advanced-filters { margin-left:32px; margin-right:32px; } .banner { margin-left:32px; margin-right:32px; } }
@media (max-width:959px) {
 .primary-filters { grid-template-columns:1fr 2fr; gap:12px; }
 .filter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
 .view-switch { display:flex; }
 .map-wrap { display:none; order:0; }
 .map-view .map-wrap { display:block; }
 .map-view .list { display:none; }
 .map { height:65dvh; min-height:320px; }
 .content { gap:0; }
 .top-actions { align-items:flex-start; }
}
@media (max-width:600px) {
 .top-inner { padding:24px 20px 20px; gap:18px; }
 .wordmark { margin-bottom:16px; font-size:10px; }
 .top h1 { font-size:28px; }
 .sub { font-size:12px; }
 .top-actions { flex-direction:row; align-items:center; justify-content:space-between; width:100%; }
 .status { font-size:10px; max-width:66%; }
 .toolbar-inner { padding:16px 20px; }
 .primary-filters { grid-template-columns:1fr 1.5fr; gap:12px; }
 .field-query { grid-column:auto; }
 .field select,.field input[type="number"],.field input[type="search"] { font-size:16px; }
 .advanced-filters { margin:0 20px; }
 .filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .banner { margin:14px 20px 0; font-size:11px; }
 .content { padding:20px; }
 .results-head { gap:12px; }
 .results-head h2 { font-size:18px; }
 .result-actions { justify-content:space-between; width:100%; }
 .result-actions select { font-size:12px; }
 .card { padding:20px; }
 .card-price b { font-size:21px; }
 .card-foot { align-items:flex-start; }
 .region-note,.foot { padding-left:20px; padding-right:20px; }
}
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; transition:none!important; } }

/* Map-first listing workspace */
.top { background:#fff; border-bottom:1px solid var(--border); }
.top-inner { max-width:none; padding:16px 24px; gap:16px; }
.wordmark { margin:0; font-size:15px; letter-spacing:.06em; }
.wordmark span { font-size:12px; }
.top h1 { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.sub { margin:4px 0 0; font-size:12px; }
.top-actions { flex-direction:row; align-items:center; }
.toolbar { position:relative; background:#fff; backdrop-filter:none; }
.toolbar-inner { max-width:none; padding:12px 24px; }
.primary-filters { grid-template-columns:110px minmax(180px,260px) minmax(200px,420px) 180px; }
.primary-filters .field > span { margin:0; }
.primary-filters .field select,.primary-filters input[type=search] { background-color:#f6f7f9; border-radius:14px; }
#filterToggle { border-radius:14px; }
.advanced-filters { position:absolute; right:24px; top:100%; width:min(720px,calc(100vw - 48px)); margin:8px 0 0; padding:20px; background:white; border:1px solid var(--border); border-radius:18px; box-shadow:0 12px 48px #17233826; max-height:65dvh; overflow:auto; }
.filter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.content { max-width:none; margin:0; padding:0; gap:0; }
.results { background:#f5f6f8; }
.results-head { padding:20px; margin:0; background:#f5f6f8f5; border-bottom:1px solid #e9ebef; }
.results-head h2 { font-size:22px; }
.results-head h2 small { font-size:11px; }
.result-actions { gap:6px; }
.result-actions select { max-width:145px; }
.list { padding:16px; gap:12px; }
.card { border-radius:18px; padding:22px; border:1px solid transparent; box-shadow:0 2px 6px #14203805; }
.card.is-selected { border-color:var(--accent); background:#f5faff; outline:1px solid var(--accent); }
.card-head .badge { font-size:11px; margin:0 0 4px; color:#5e7187; }
.card-title { font-size:16px; line-height:1.5; }
.card-price { margin-top:12px; font-size:12px; }
.card-price b { font-size:22px; }
.card-meta { font-size:12px; line-height:1.7; }
.card-feature { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:#6e6e73; margin-top:10px; }
.card-tags { margin-top:10px; }
.card-foot { margin-top:12px; padding-top:10px; }
.banner { margin:12px 16px 0; font-size:11px; padding:10px 12px; max-height:140px; overflow:auto; }
.progress { margin:12px 16px; }
.map-wrap { position:relative; top:auto; order:0; border:0; border-left:1px solid var(--border); border-radius:0; box-shadow:none; }
.map { height:100%; max-height:none; min-height:0; }
.map-caption { position:absolute; z-index:500; top:16px; left:16px; padding:12px 16px; border:1px solid #e5e5e9; border-radius:14px; background:#ffffffee; box-shadow:0 2px 10px #0001; font-size:13px; font-weight:650; pointer-events:none; }
.map-caption span { display:block; font-size:11px; color:var(--muted); font-weight:400; margin-top:2px; }
.leaflet-top.leaflet-left { top:auto; left:auto; right:16px; bottom:40px; }
.region-note,.foot { padding:8px 20px; margin:0; font-size:10px; }
.foot { padding-bottom:24px; }
@media (min-width:960px) {
 html,body { height:100%; overflow:hidden; }
 body { display:flex; flex-direction:column; }
 .top,.toolbar { flex-shrink:0; }
 .content { flex:1; min-height:0; width:100%; grid-template-columns:440px minmax(0,1fr); align-items:stretch; }
 .results { overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
 .results-head { position:sticky; top:0; z-index:5; }
 .map-wrap { height:100%; }
 .map { height:100%; }
}
@media (min-width:1600px) { .content { grid-template-columns:480px minmax(0,1fr); } }
@media (max-width:959px) {
 .top-inner { padding:14px 16px; }
 .top-actions { gap:6px; }
 .status { max-width:220px; }
 .toolbar-inner { padding:12px 16px; }
 .primary-filters { grid-template-columns:1fr 2fr; gap:10px; }
 .content { display:block; }
 .results-head { position:sticky; top:0; z-index:10; padding:16px; }
 .map-wrap { display:none; border:0; }
 .map-view .map-wrap { display:block; }
 .map-view .region-note,.map-view .foot { display:none; }
 .map { height:65dvh; min-height:300px; }
 .view-switch { display:flex; }
 .advanced-filters { right:16px; width:calc(100vw - 32px); }
}
@media (max-width:600px) {
 .wordmark { font-size:13px; }
 .top-actions { width:100%; justify-content:space-between; }
 .status { max-width:54%; font-size:10px; }
 .top-actions .btn { font-size:11px; padding:7px 10px; }
 .sub { font-size:11px; }
 .primary-filters { grid-template-columns:110px minmax(0,1fr); }
 .primary-filters .field-query { grid-column:1; }
 .primary-filters .field-query input { font-size:13px; }
 .primary-filters .field-query { grid-column:1 / -1; padding-right:150px; }
 #filterToggle { grid-column:2; grid-row:2; width:140px; justify-self:end; align-self:end; }
 .filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .card { padding:20px; }
 .card-price b { font-size:21px; }
 .result-actions { width:100%; }
}
