@font-face { font-family: 'BMJUA'; src: url('/vendor/BMJUA.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'SsurroundAir'; src: url('/vendor/Cafe24SsurroundAir.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Ssurround'; src: url('/vendor/Cafe24Ssurround.woff') format('woff'); font-display: swap; }

:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1a1d21; --sub: #8a919b;
  --line: #e7e9ee; --accent: #03c75a; --accent-soft: #e6f9ef;
  --chip: #eceef2; --chip-on: #1a1d21; --chip-on-text: #fff;
  --hover: #f0f1f4; --shadow: rgba(30,40,60,.08); --glass: rgba(255,255,255,.85);
  --danger: #e5484d; --warn: #f5a623;
  --skeleton: #e6e8ed; --shine: rgba(255,255,255,.95);
}
:root[data-theme="dark"] {
  --bg: #101317; --card: #1a1f25; --text: #e9ebee; --sub: #98a1ac;
  --line: #272e36; --accent: #0fd66b; --accent-soft: #123722;
  --chip: #232a32; --chip-on: #e9ebee; --chip-on-text: #101317;
  --hover: #202730; --shadow: rgba(0,0,0,.35); --glass: rgba(26,31,37,.88);
  --danger: #ff8589; --warn: #ffc043;
  --skeleton: #222831; --shine: rgba(255,255,255,.08);
}
/* ── 안전 영역(노치) ──
   홈 화면 앱(standalone)일 때만 위·좌·우 여백을 준다. 브라우저 탭에서는
   주소창이 가려 주므로 여백을 두면 화면만 좁아진다.
   아래쪽은 홈 인디케이터가 겹쳐도 보기 나쁘지 않아 0으로 둔다
   (필요해지면 --sa-bottom 에도 위쪽처럼 안전 영역 값을 넣으면 된다). */
:root {
  --sa-top: 0px;
  --sa-right: 0px;
  --sa-bottom: 0px;
  --sa-left: 0px;
}
html.standalone {
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font-family: 'SsurroundAir', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  transition: background .35s, color .35s;
  /* 더블탭 확대를 막는다. 손가락 두 개로 지도를 키우는 건 Leaflet이 따로 처리한다 */
  touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
.jua { font-family: 'BMJUA', sans-serif; }
.hidden { display: none !important; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 공통 컨트롤 ── */
.btn {
  border: 0; border-radius: 12px; padding: 11px 18px; font-family: 'BMJUA'; font-size: 14px;
  cursor: pointer; background: var(--chip); color: var(--text);
  /* 글리프·이모지가 항상 가운데 오도록 */
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), filter .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.kakao { background: #fee500; color: #3c1e1e; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }

.input {
  width: 100%; padding: 12px 16px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
  vertical-align: -2px;
}

/* ── 인증 화면 ── */
#authView {
  height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(20px + var(--sa-top)) calc(20px + var(--sa-right))
           calc(20px + var(--sa-bottom)) calc(20px + var(--sa-left));
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 32px 28px; box-shadow: 0 12px 40px var(--shadow);
  animation: pop .4s cubic-bezier(.22,1,.36,1) both;
}
.auth-logo {
  width: 68px; height: 68px; border-radius: 20px; display: block; margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(10, 224, 124, .28);
}
.auth-card h1 { font-family: 'BMJUA'; font-size: 27px; margin-bottom: 4px; letter-spacing: -.01em; }
.auth-card .lead { font-size: 13px; color: var(--sub); margin-bottom: 22px; line-height: 1.5; }
.auth-card .input { margin-bottom: 10px; }
.auth-card .btn { width: 100%; margin-top: 6px; }
/* 구글 로그인 영역 */
#socialWrap { margin-top: 16px; }
.auth-or {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--sub); margin-bottom: 12px;
}
.auth-or::before, .auth-or::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
#googleBtn { display: flex; justify-content: center; min-height: 44px; }

.auth-switch { margin-top: 16px; font-size: 13px; color: var(--sub); text-align: center; }
.auth-switch b { color: var(--accent); cursor: pointer; }
.auth-err { color: var(--danger); font-size: 12.5px; margin: 6px 0 2px; min-height: 17px; }
.invite-banner {
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px;
  padding: 10px 13px; border-radius: 12px; margin-bottom: 16px; line-height: 1.5;
}

/* ── 앱 레이아웃 ── */
/* position:fixed 로 두면 안에 있는 필터 서랍(position:fixed, z-index)이 이 요소의
   쌓임 맥락에 갇혀 #backdrop 아래로 깔린다 — 서랍이 눌리지 않는다. 일반 흐름으로 둔다.
   (아이폰 홈 화면 앱의 아래 여백은 status-bar-style 로 해결했다) */
#appView { height: 100dvh; display: flex; }

aside {
  width: calc(250px + var(--sa-left)); flex-shrink: 0; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; height: 100%; background: var(--card);
  padding-top: var(--sa-top); padding-left: var(--sa-left);
}
.side-head { padding: 18px 16px 12px; border-bottom: 1px solid var(--line); }
.side-head .brand { font-family: 'BMJUA'; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand-logo { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; }
.side-head .who { font-size: 12px; color: var(--sub); margin-top: 3px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 12px 10px; }
.side-title {
  font-family: 'BMJUA'; font-size: 11.5px; color: var(--sub); letter-spacing: .08em;
  padding: 8px 8px 6px; display: flex; justify-content: space-between; align-items: center;
}
.side-title .add { cursor: pointer; font-size: 15px; color: var(--accent); }
.side-foot { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 6px; }
.side-foot .btn { flex: 1; }

.board-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 12px;
  cursor: pointer; font-size: 13.5px; user-select: none;
  transition: background .18s, transform .12s;
}
.board-item:hover { background: var(--hover); }
.board-item:active { transform: scale(.97); }
.board-item.active { background: var(--accent-soft); color: var(--accent); }
.board-item .bi-emoji { font-size: 16px; }
.board-item .bi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item .bi-cnt { font-family: 'BMJUA'; font-size: 11px; color: var(--sub); }
.board-item.active .bi-cnt { color: var(--accent); }
.role-badge {
  font-size: 9.5px; font-family: 'BMJUA'; padding: 2px 6px; border-radius: 6px;
  background: var(--chip); color: var(--sub);
}
.role-badge.editor { background: #e3f0ff; color: #2b6cb0; }
.role-badge.viewer { background: var(--chip); color: var(--sub); }
:root[data-theme="dark"] .role-badge.editor { background: #1c3149; color: #7fb5ec; }

/* 지역 트리 */
.region-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; user-select: none;
  transition: background .18s, color .18s, transform .12s;
}
.region-item:hover { background: var(--hover); }
.region-item:active { transform: scale(.96); }
.region-item.active { background: var(--accent-soft); color: var(--accent); }
.region-item .cnt { font-family: 'BMJUA'; font-size: 11.5px; color: var(--sub); }
.region-item.active .cnt { color: var(--accent); }
.sido > .region-item { font-family: 'Ssurround'; }
.sido .arrow { display: inline-block; width: 13px; font-size: 9px; color: var(--sub); transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.sido.open .arrow { transform: rotate(90deg); }
.gugun-list { display: grid; grid-template-rows: 0fr; margin-left: 12px; transition: grid-template-rows .3s cubic-bezier(.22,1,.36,1); }
.gugun-inner { overflow: hidden; min-height: 0; }
.sido.open .gugun-list { grid-template-rows: 1fr; }
.gugun-list .region-item { font-size: 12px; padding: 4px 10px; }

/* ── 메인 ── */
main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%;
  padding: calc(16px + var(--sa-top)) calc(20px + var(--sa-right))
           calc(14px + var(--sa-bottom)) 20px;
}
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.head-row h1 { font-family: 'BMJUA'; font-size: 21px; display: flex; align-items: center; gap: 8px; }
.head-row .meta { font-size: 12px; color: var(--sub); margin-top: 3px; }
.head-title { min-width: 0; }
.board-switch {
  display: flex; align-items: center; gap: 7px; background: none; border: 0;
  padding: 4px 8px 4px 0; color: inherit; cursor: pointer; border-radius: 10px; max-width: 100%;
  transition: background .18s, transform .12s;
}
.board-switch:hover { background: var(--hover); }
.board-switch:active { transform: scale(.97); }
.board-switch h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-caret { color: var(--sub); font-size: 12px; flex-shrink: 0; }
#boardPicker { max-height: 46vh; overflow-y: auto; margin: 0 -4px; }
#boardPicker .board-item { font-size: 14px; }
.picker-head { display: flex; align-items: center; gap: 12px; }
.picker-logo { width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0; }
.picker-who { font-size: 12px; color: var(--sub); margin-top: 2px; }
#pickerModal .actions { align-items: center; }

/* 테마 전환 줄 — 줄 전체가 터치 영역 (사이드바 계정 영역 · 계정 모달) */
.theme-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; user-select: none;
}
.side-head .theme-row { margin-top: 10px; min-height: 32px; }
.side-head .theme-row .pp-label { font-size: 12px; color: var(--sub); }

.picker-pref {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 11px 14px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
  cursor: pointer; user-select: none; transition: background .2s;
}
.picker-pref:hover { background: var(--hover); }
.pp-label { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.picker-pref .switch { padding: 0; }
.head-actions { display: flex; gap: 7px; align-items: center; flex-shrink: 0; }
.head-actions .ico { display: none; }
/* 장소 추가 모달 */
#addModal .input { border-radius: 12px; }
.add-kinds { margin-top: 12px; font-size: 12px; color: var(--sub); }
.add-kinds > div { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.add-kinds .k {
  flex-shrink: 0; min-width: 36px; text-align: center;
  background: var(--chip); color: var(--text); border-radius: 6px;
  font-size: 10.5px; padding: 3px 6px; font-family: 'BMJUA';
}

.controls { display: flex; gap: 9px; align-items: center; margin-bottom: 11px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 340px; display: flex; }
#search { flex: 1; min-width: 0; border-radius: 999px; padding: 10px 16px; font-size: 13.5px; }
#search::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--chip); color: var(--sub); font-size: 12px;
}
.search-clear:active { background: var(--hover); }
.seg { position: relative; display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; user-select: none; }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 9px; background: var(--card); box-shadow: 0 2px 8px var(--shadow); transition: left .3s cubic-bezier(.22,1,.36,1), width .3s cubic-bezier(.22,1,.36,1); }
.seg button { position: relative; z-index: 1; border: 0; background: none; color: var(--sub); font-family: 'BMJUA'; font-size: 12.5px; padding: 7px 15px; cursor: pointer; border-radius: 9px; transition: color .2s; }
.seg button.on { color: var(--text); }
select.sort { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; outline: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  background: var(--chip); font-size: 12.5px; cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s, transform .18s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.chip:hover { border-color: var(--sub); transform: translateY(-1px); }
.chip:active { transform: scale(.9); }
.chip.on { background: var(--chip-on); color: var(--chip-on-text); }
.chip .c { font-family: 'BMJUA'; opacity: .65; font-size: 11.5px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* 태그 필터 칩 */
.chip.tag-chip { background: transparent; border-color: var(--line); }
.chip.tag-chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* 사라진 장소 숨기기 토글 */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; padding: 4px 2px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--chip);
  position: relative; flex-shrink: 0; transition: background .22s;
}
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 3px var(--shadow); transition: transform .22s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(16px); }
.switch-label { font-size: 12.5px; color: var(--sub); }
.switch-label b { color: var(--text); font-weight: 400; font-family: 'BMJUA'; font-size: 11px; }
#goneWrap { margin: 2px 0 10px; }

/* 시트 안 태그 편집기 */
.tag-edit {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--card);
}
.tag-edit:focus-within { border-color: var(--accent); }
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent); padding: 4px 6px 4px 9px; border-radius: 999px;
}
.tag-pill button {
  border: 0; background: none; color: inherit; cursor: pointer; font-size: 10px;
  opacity: .7; padding: 0 2px; line-height: 1;
}
.tag-pill button:hover { opacity: 1; }
.tag-input {
  flex: 1; min-width: 90px; border: 0; outline: none; background: none; color: var(--text);
  font-size: 12.5px; padding: 4px 2px;
}
.tag-hint { font-size: 11px; color: var(--sub); margin-top: 5px; }

.subchips-wrap { border-left: 3px solid var(--accent-soft); padding-left: 10px; margin: 0 0 10px; animation: fadeUp .32s cubic-bezier(.22,1,.36,1) both; }
.subchips-label { font-size: 11.5px; color: var(--sub); margin-bottom: 6px; }
.subchips-wrap .chip { padding: 5px 11px; font-size: 12px; }

.result-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; font-size: 12.5px; color: var(--sub); }
.result-bar b { font-family: 'BMJUA'; color: var(--text); font-weight: 400; }

.content { display: flex; gap: 13px; flex: 1; min-height: 0; }
.pane-resizer { display: none; }
#listPane { flex: 1; overflow-y: auto; min-width: 0; padding-right: 2px; }
#mapPane { flex: 1.15; min-width: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 6px 24px var(--shadow); display: none; }
#map { width: 100%; height: 100%; background: var(--chip); }
body.mode-split #mapPane, body.mode-map #mapPane { display: block; animation: fadeUp .35s cubic-bezier(.22,1,.36,1) both; }
body.mode-split #listPane { flex: 0 0 42%; }
body.mode-split .list { grid-template-columns: 1fr; }
body.mode-map #listPane { display: none; }

.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding-bottom: 24px; }
.item {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 13px 15px;
  cursor: pointer; animation: fadeUp .3s cubic-bezier(.22,1,.36,1) both;
  transition: border-color .18s, transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  /* grid 아이템의 기본 min-width:auto 를 풀어야 긴 주소가 카드를 밀어내지 않는다 */
  min-width: 0;
  overflow: hidden;
}
.item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px var(--shadow); }
.item:active { transform: scale(.985); }
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 18px var(--shadow); }
.item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; min-width: 0; }
.item .name { font-family: 'Ssurround'; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.item .badge {
  flex-shrink: 1; font-size: 10.5px; color: var(--accent); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 999px; max-width: 52%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item .addr { font-size: 12px; color: var(--sub); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .memo { font-size: 12px; margin-top: 7px; padding: 6px 10px; background: var(--chip); border-radius: 10px; }
.item .mini { display: flex; gap: 9px; margin-top: 7px; font-size: 11.5px; color: var(--sub); align-items: center; flex-wrap: wrap; }
.item .mini .star { color: var(--warn); font-family: 'BMJUA'; }
.item .mini .sc { display: inline-flex; align-items: center; gap: 3px; }
.item .mini .src {
  font-family: 'BMJUA'; font-size: 8.5px; font-style: normal; width: 13px; height: 13px;
  border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.item .mini .src.n { background: var(--accent); color: #fff; }
.item .mini .src.k { background: #fee500; color: #3c1e1e; }
.item .tag { font-size: 10.5px; background: var(--chip); color: var(--sub); padding: 2px 8px; border-radius: 999px; }
/* 주기 점검 결과 표시 */
.flag { font-size: 10.5px; font-family: 'BMJUA'; padding: 2px 8px; border-radius: 999px; }
.flag.gone { background: #fdecec; color: #c5323a; }
.flag.moved { background: #fff3e0; color: #b26a00; }
:root[data-theme="dark"] .flag.gone { background: #3a1d1f; color: #ff8589; }
:root[data-theme="dark"] .flag.moved { background: #3a2d18; color: #ffc043; }
.item.is-gone { opacity: .62; }
.item.is-gone .name { text-decoration: line-through; text-decoration-color: var(--sub); }

.sh-notice { margin-top: 12px; padding: 11px 13px; border-radius: 12px; font-size: 12.5px; line-height: 1.6; }
.sh-notice b { font-family: 'Ssurround'; font-weight: 400; }
.sh-notice div { color: inherit; opacity: .85; margin-top: 3px; }
.sh-notice.gone { background: #fdecec; color: #c5323a; }
.sh-notice.moved { background: #fff3e0; color: #b26a00; }
:root[data-theme="dark"] .sh-notice.gone { background: #3a1d1f; color: #ff8589; }
:root[data-theme="dark"] .sh-notice.moved { background: #3a2d18; color: #ffc043; }
.item .pending { color: var(--sub); font-size: 11px; }
.empty { text-align: center; color: var(--sub); padding: 60px 16px; font-size: 14px; grid-column: 1/-1; line-height: 1.7; animation: fadeUp .3s ease both; }
.list-sentinel {
  grid-column: 1/-1; text-align: center; color: var(--sub); font-size: 12.5px;
  padding: 18px 0 28px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; }

/* ── 지도 핀 ── */
.pin-wrap, .cluster-wrap { background: none !important; border: none !important; }
.pin {
  position: relative; width: 34px; height: 34px; border-radius: 40%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.3); transform-origin: 50% 130%;
  animation: pinIn .4s cubic-bezier(.34,1.56,.64,1) both;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
.pin::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 6px solid transparent; border-top: 9px solid #fff; }
.pin:hover { transform: scale(1.18); }
.pin.selected { transform: scale(1.32); box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: pinBounce .5s cubic-bezier(.34,1.56,.64,1); z-index: 10; }
@keyframes pinIn { from { opacity: 0; transform: translateY(-14px) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes pinBounce { 0% { transform: scale(1); } 45% { transform: scale(1.5) translateY(-5px); } 100% { transform: scale(1.32); } }
.cluster-pin {
  display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff;
  font-family: 'BMJUA'; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.32);
  animation: pinIn .35s cubic-bezier(.34,1.56,.64,1) both;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.cluster-pin:hover { transform: scale(1.14); }
.cluster-pin .badge-emoji { position: absolute; top: -7px; right: -7px; font-size: 13px; }
.leaflet-container { font-family: 'SsurroundAir', sans-serif; }
.leaflet-tooltip { font-family: 'Ssurround'; border-radius: 8px; border: 1px solid var(--line); background: var(--glass); color: var(--text); backdrop-filter: blur(8px); }

/* ── 시트 / 모달 ── */
#backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 900; }
body.sheet-open #backdrop, body.modal-open #backdrop, body.region-open #backdrop { opacity: 1; pointer-events: auto; }

#sheet {
  position: fixed; top: calc(14px + var(--sa-top)); right: calc(14px + var(--sa-right));
  bottom: calc(14px + var(--sa-bottom)); width: 390px; max-width: 92vw;
  background: var(--glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 18px 50px rgba(0,0,0,.28);
  z-index: 950; overflow-y: auto; padding: 20px;
  transform: translateX(calc(100% + 30px)); opacity: 0;
  transition: transform .42s cubic-bezier(.22,1,.36,1), opacity .3s;
}
body.sheet-open #sheet { transform: none; opacity: 1; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--chip); color: var(--sub); font-size: 14px; cursor: pointer; z-index: 2; }
.sh-imgs { display: flex; gap: 6px; margin-bottom: 14px; border-radius: 16px; overflow: hidden; }
/* 사진이 오기 전 자리 — 빛이 한 번씩 훑고 지나가 로딩 중임을 알린다 */
.sh-img {
  position: relative; flex: 1; min-width: 0; height: 96px;
  background: var(--skeleton); overflow: hidden;
}
.sh-img::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--shine) 50%, transparent 80%);
  background-size: 300% 100%;
  animation: shine 1.3s linear infinite;
}
.sh-img.loaded::after, .sh-img.failed::after { content: none; }
.sh-img.failed { display: none; }          /* 못 받아온 사진은 자리째 접는다 */
.sh-imgs img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s ease;
}
.sh-img.loaded img { opacity: 1; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .sh-img::after { animation: none; content: none; }
}
.sh-name { font-family: 'BMJUA'; font-size: 21px; padding-right: 32px; }
.sh-cat { font-size: 12.5px; color: var(--accent); margin-top: 3px; }
.sh-stars { margin-top: 7px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.sh-stars .star { color: var(--warn); font-family: 'BMJUA'; }
.sh-stars .rv { color: var(--sub); font-size: 12px; }
.sh-stars .src { font-family: 'BMJUA'; font-size: 10px; width: 17px; height: 17px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sh-stars .src.n { background: #03c75a; color: #fff; }
.sh-stars .src.k { background: #fee500; color: #3c1e1e; }
.sh-status { display: inline-block; margin-top: 10px; font-family: 'BMJUA'; font-size: 12.5px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.sh-status.closed { background: #fdecec; color: #e5484d; }
:root[data-theme="dark"] .sh-status.closed { background: #3a1d1f; color: #ff8589; }
.sh-sec { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.sh-sec .t { font-family: 'BMJUA'; font-size: 12px; color: var(--sub); margin-bottom: 7px; letter-spacing: .05em; }
.sh-row { font-size: 13px; line-height: 1.55; }
.hours-all { margin-top: 6px; font-size: 12.5px; color: var(--sub); display: none; }
.hours-all.open { display: block; animation: fadeUp .25s ease both; }
.hours-all div { display: flex; justify-content: space-between; padding: 2px 0; }
.hours-all .today { color: var(--text); font-family: 'Ssurround'; }
.hours-toggle { background: none; border: 0; color: var(--accent); font-size: 12px; cursor: pointer; padding: 2px 0; }
.sh-links { display: flex; flex-wrap: wrap; gap: 7px; }
.sh-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--chip); padding: 8px 13px; border-radius: 999px; transition: transform .18s cubic-bezier(.34,1.56,.64,1); }
.sh-link:hover { transform: translateY(-1px) scale(1.03); }
.sh-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.sh-tag { font-size: 11px; background: var(--chip); color: var(--sub); padding: 4px 9px; border-radius: 999px; }
.sh-quote { font-size: 12.5px; background: var(--chip); border-radius: 12px; padding: 10px 13px; line-height: 1.5; }
.sh-cta { display: flex; gap: 8px; margin-top: 16px; }
.sh-cta a { flex: 1; text-align: center; font-family: 'BMJUA'; font-size: 13.5px; padding: 13px 6px; border-radius: 14px; white-space: nowrap; transition: transform .18s cubic-bezier(.34,1.56,.64,1), filter .2s; }
.sh-cta a:hover { transform: translateY(-1px); filter: brightness(1.05); }
.sh-naver { background: var(--accent); color: #fff; }
.sh-kakao { background: #fee500; color: #3c1e1e; }
.sh-memo-edit { width: 100%; min-height: 62px; resize: vertical; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 12.5px; outline: none; }
.sh-memo-edit:focus { border-color: var(--accent); }
.sh-editrow { display: flex; gap: 6px; margin-top: 7px; }

.modal {
  position: fixed; z-index: 960; top: 50%; left: 50%; transform: translate(-50%, -46%) scale(.97);
  width: 420px; max-width: 92vw; overflow-y: auto;
  max-height: calc(84vh - var(--sa-top) - var(--sa-bottom));
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); opacity: 0; pointer-events: none;
  transition: opacity .28s, transform .28s cubic-bezier(.22,1,.36,1);
}
body.modal-open .modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal h2 { font-family: 'BMJUA'; font-size: 18px; margin-bottom: 4px; }
.modal .lead { font-size: 12.5px; color: var(--sub); margin-bottom: 16px; line-height: 1.5; }
.modal .row { display: flex; gap: 8px; margin-bottom: 10px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.member-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.member-row .mr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.member-row .mr-email { font-size: 11px; color: var(--sub); }
.share-link { display: flex; gap: 6px; margin-top: 10px; }
.share-link input { flex: 1; font-size: 11.5px; padding: 9px 11px; }
.activity-row { font-size: 12.5px; color: var(--sub); padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.activity-row b { color: var(--text); font-weight: 400; font-family: 'Ssurround'; }

/* ── 지도 뷰 하단 미니 카드 ── */
#peek {
  position: fixed; left: calc(10px + var(--sa-left)); right: calc(10px + var(--sa-right));
  bottom: calc(10px + var(--sa-bottom)); z-index: 940; display: none;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 10px 34px rgba(0,0,0,.32);
  transform: translateY(calc(100% + 24px)); opacity: 0;
  transition: transform .38s cubic-bezier(.22,1,.36,1), opacity .25s;
}
body.peek-open #peek { display: block; transform: none; opacity: 1; }
#peek.dragging { transition: none; }
.peek-body { padding: 14px 44px; cursor: pointer; }
.peek-name { font-family: 'Ssurround'; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-cat { font-size: 11.5px; color: var(--accent); margin-top: 2px; }
.peek-addr { font-size: 12px; color: var(--sub); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-meta { display: flex; gap: 9px; align-items: center; margin-top: 7px; font-size: 11.5px; color: var(--sub); flex-wrap: wrap; }
.peek-meta .star { color: var(--warn); font-family: 'BMJUA'; }
.peek-meta .src {
  font-family: 'BMJUA'; font-size: 8.5px; font-style: normal; width: 13px; height: 13px;
  border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
}
.peek-meta .src.n { background: var(--accent); color: #fff; }
.peek-meta .src.k { background: #fee500; color: #3c1e1e; }
.peek-meta .sc { display: inline-flex; align-items: center; gap: 3px; }
.peek-idx {
  position: absolute; top: 10px; right: 14px; font-family: 'BMJUA'; font-size: 10.5px;
  color: var(--sub); background: var(--chip); padding: 2px 8px; border-radius: 999px;
}
.peek-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 44px; border: 0; background: none; color: var(--sub);
  font-size: 26px; line-height: 1; cursor: pointer; border-radius: 10px;
}
.peek-nav:active { background: var(--hover); }
.peek-nav.prev { left: 0; }
.peek-nav.next { right: 0; }
.peek-nav[disabled] { opacity: .25; }

/* 토스트 */
#toasts { position: fixed; bottom: calc(20px + var(--sa-bottom)); left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--chip-on); color: var(--chip-on-text); padding: 12px 20px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 8px 26px rgba(0,0,0,.28); animation: fadeUp .3s cubic-bezier(.22,1,.36,1) both;
  max-width: 88vw; text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }

.region-btn { display: none; }

/* ── 모바일 ── */
@media (max-width: 860px) {
  /* 키보드가 올라온 동안에만 --vvh 가 채워진다(app.js 의 trackKeyboard) */
  #appView { flex-direction: column; height: var(--vvh, 100dvh); }
  main {
    padding: calc(12px + var(--sa-top)) calc(13px + var(--sa-right))
             calc(10px + var(--sa-bottom)) calc(13px + var(--sa-left));
    height: 100%;
  }
  .head-row h1 { font-size: 18px; }

  /* 키보드가 올라오면 헤더를 접어 목록을 최대한 보여준다 */
  body.kb-open .head-row { display: none; }
  body.kb-open main { padding-top: calc(10px + var(--sa-top)); }
  body.kb-open #peek { display: none; }

  aside {
    position: fixed; left: calc(10px + var(--sa-left)); right: calc(10px + var(--sa-right));
    bottom: calc(10px + var(--sa-bottom)); top: auto; width: auto; height: auto;
    max-height: 72dvh; z-index: 940; border-right: 0; border: 1px solid var(--line);
    padding-top: 0; padding-left: 0;
    border-radius: 24px; background: var(--glass); backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px); box-shadow: 0 -10px 44px rgba(0,0,0,.3);
    padding-bottom: 0;
    transform: translateY(calc(100% + 40px)); transition: transform .42s cubic-bezier(.22,1,.36,1);
  }
  aside::before { content: ''; display: block; width: 40px; height: 4.5px; border-radius: 3px; background: var(--line); margin: 10px auto 2px; flex-shrink: 0; }
  body.region-open aside { transform: none; }

  .region-btn { display: inline-flex; }
  .search-wrap { max-width: none; flex-basis: 100%; order: -1; }
  .seg { margin-left: auto; }
  .seg button { padding: 7px 11px; font-size: 12px; }
  #sortWrap { display: none; }          /* 정렬은 필터 시트 안으로 */

  /* ── 상단 공간 절약: 헤더 버튼은 아이콘만, 정사각형으로 정렬 ── */
  .head-actions .btn.sm { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 16px; }
  .head-actions .lbl { display: none; }
  .head-actions .ico { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
  #addToggle .ico { font-size: 20px; margin-top: -1px; }   /* ＋ 글리프 광학 보정 */

  /* ── 필터는 시트 하나로 모은다 (업종·세부·정렬이 #filterHost 로 이동) ── */
  #mainFilters:empty { display: none; }
  #filterHost .chips {
    flex-wrap: wrap; overflow: visible; margin: 0 0 6px; padding: 0 8px;
  }
  #filterHost .subchips-wrap { margin: 0 8px 8px; }
  #filterHost #goneWrap { padding: 4px 10px 10px; }
  #filterHost .switch { min-height: 44px; }
  #filterHost #sortWrap { display: block; padding: 0 8px 8px; }
  #filterHost select.sort { width: 100%; max-width: none; padding: 11px 12px; font-size: 13.5px; }

  /* ── 터치 영역: 손가락으로 누를 수 있는 최소 크기(44px) 확보 ── */
  .chip { min-height: 44px; padding: 0 15px; font-size: 13px; }
  .subchips-wrap .chip { min-height: 40px; padding: 0 13px; }
  .seg { padding: 4px; }
  .seg button { min-height: 40px; padding: 0 14px; }
  .btn.sm { min-height: 44px; }
  .picker-pref { min-height: 52px; }
  .board-item, .region-item { min-height: 44px; }
  .gugun-list .region-item { min-height: 40px; }
  .sheet-close { width: 40px; height: 40px; font-size: 16px; }
  .hours-toggle { min-height: 40px; padding: 0; }
  .sh-link { min-height: 42px; }
  select.sort { min-height: 44px; }
  .board-switch { min-height: 44px; }

  /* 필터 시트에는 필터만 남긴다.
     지도 전환·계정·로그아웃은 상단 제목의 '내 지도' 모달로 옮겼다. */
  #boardsTitle, #boardList, aside .side-head, aside .side-foot { display: none; }
  aside .side-scroll > .side-title { margin-top: 0 !important; }
  aside { padding-top: 4px; }

  /* 필터 버튼 — 걸린 조건 요약 */
  #regionBtn { max-width: 46vw; overflow: hidden; }
  #regionBtn .fb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #regionBtn .fb-count {
    background: var(--accent); color: #fff; font-family: 'BMJUA'; font-size: 10px;
    border-radius: 999px; padding: 1px 6px; flex-shrink: 0;
  }
  #regionBtn.on { background: var(--accent-soft); color: var(--accent); }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -13px; margin-right: -13px; padding: 0 13px 3px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  .subchips-wrap { margin-left: 0; }
  .content { flex-direction: column-reverse; gap: 4px; }
  body.mode-split #listPane { flex: 1; min-height: 0; }
  body.mode-split #mapPane { flex: 0 0 38%; border-radius: 16px; }

  /* 지도/목록 사이 손잡이 — 끌어서 지도 높이 조절 */
  body.mode-split .pane-resizer {
    display: flex; align-items: center; justify-content: center;
    height: 22px; flex-shrink: 0; cursor: row-resize; touch-action: none;
  }
  .pane-resizer span {
    width: 46px; height: 5px; border-radius: 3px; background: var(--line);
    transition: background .2s, width .2s;
  }
  .pane-resizer:active span { background: var(--accent); width: 64px; }

  /* 상세 시트 — 손잡이 + 아래로 쓸어내려 닫기 */
  #sheet::before {
    content: ''; display: block; width: 40px; height: 4.5px; border-radius: 3px;
    background: var(--line); margin: -6px auto 12px; flex-shrink: 0;
  }
  /* 끄는 동안에는 손가락을 그대로 따라오게(전환 효과 끔) */
  #sheet.dragging, aside.dragging { transition: none; }
  .list { grid-template-columns: 1fr !important; }
  #sheet {
    top: auto; left: calc(10px + var(--sa-left)); right: calc(10px + var(--sa-right));
    bottom: calc(10px + var(--sa-bottom)); width: auto; max-width: none;
    max-height: 76dvh; padding-bottom: 20px;
    transform: translateY(calc(100% + 40px));
  }
  body.sheet-open #sheet { transform: none; }
}
