* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --hh: 60px;
  --primary: #4F6EF7;
  --primary-hover: #3D5CE8;
  --primary-light: #EEF1FF;
  --primary-dim: #C7CDFB;
  --gold: #F59E0B;
  --gold-light: #FFFBEB;
  --green: #059669;
  --green-light: #ECFDF5;
  --red: #EF4444;
  --text: #1A1D2E;
  --text2: #4B5563;
  --text3: #9CA3AF;
  --border: #E8EAF0;
  --border-light: #F1F3F8;
  --surface: #FFFFFF;
  --bg: #F7F8FC;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 4px rgba(26, 29, 46, 0.06), 0 1px 2px rgba(26, 29, 46, 0.04);
  --shadow-md: 0 4px 20px rgba(26, 29, 46, 0.10);
  --shadow-lg: 0 8px 40px rgba(26, 29, 46, 0.14);
  --shadow-up: 0 -8px 40px rgba(26, 29, 46, 0.12);
  --shadow-primary: 0 4px 16px rgba(79, 110, 247, 0.28);
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── 헤더 ── */
#header {
  background: transparent;
  padding: 0 16px;
  height: var(--hh);
  display: flex;
  align-items: center;
  gap: 10px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

#toggle-list-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(221, 221, 221, 0.8);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--text);
  border-radius: 10px;
  transition: all 0.18s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#toggle-list-btn:hover {
  background: rgba(211, 211, 211, 0.8);
}

#header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  margin-right: 200px;
}

#search-btn {
  padding: 7px 14px;
  border: 1px solid rgba(221, 221, 221, 0.8);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.18s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

#search-btn:hover {
  background: rgba(187, 187, 187, 0.8);
  color: var(--text);
  border-color: rgba(71, 71, 71, 0.16);
}

#search-inline-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s;
}

#search-inline-wrap.open {
  width: calc(100vw - 80px);
  opacity: 1;
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s;
  font-family: inherit;
  font-weight: 500;
}

#search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 180, 180, 0.1);
}

#settings-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(221, 221, 221, 0.8);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--text);
  border-radius: 10px;
  transition: all 0.18s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#settings-btn:hover {
  background: rgba(219, 219, 219, 0.8);
}

/* ── 지도 ── */
#map {
  width: 100%;
  height: 100vh;
}

/* ── 패널 (상세보기) ── */
#panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-up);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  height: auto;
  max-height: 85vh;
  overflow: hidden;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255, 255, 255, 0.6);
}

#panel.open {
  transform: translateY(0);
}

#panel-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  min-height: 36px;
  flex-shrink: 0;
  position: relative;
}

#panel-scroll {
  padding-top: 20px;
}

#panel-handle span {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  display: none;
}

#panel-scroll {
  flex: 0 1 auto;
  overflow-y: auto;
  max-height: 85vh;
}

#panel-content {
  padding: 4px 24px 32px;
}

#panel-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
}

#panel-close:hover {
  background: transparent;
  color: var(--text);
  transform: translateY(-50%) scale(1.05);
}

#panel h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

#panel-stars {
  display: flex;
  gap: 3px;
  margin: 4px 0 14px;
}

.star {
  font-size: 22px;
  cursor: pointer;
  color: var(--border);
  line-height: 1;
  transition: color 0.1s, transform 0.1s;
}

.star.filled {
  color: var(--gold);
}

.star:hover {
  color: var(--gold);
  transform: scale(1.15);
}

#panel-category-select {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--primary-dim);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

#panel-subcat-wrap {
  display: none;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.panel-subcat-btn {
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text3);
  transition: all 0.18s;
}

.panel-subcat-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-light);
}

.panel-subcat-btn.on {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

#panel .address {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

#panel .memo {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 10px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

#panel .source-link {
  margin-top: 10px;
}

#panel .source-link a {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#panel .source-link a:hover {
  text-decoration: underline;
}

#panel-hours {
  min-height: 24px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text2);
}

#map-links {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-link-btn {
  flex: 1;
  min-width: 82px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.18s;
  letter-spacing: -0.2px;
}

.map-link-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.map-link-btn.kakao {
  background: #FEE500;
  color: #191919;
}

.map-link-btn.naver {
  background: #03C75A;
  color: #fff;
}

.map-link-btn.google {
  background: #EA4335;
  color: #fff;
}

#panel-save-btn {
  display: none;
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: -0.3px;
  transition: all 0.18s;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

#panel-save-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

#panel-save-btn:disabled {
  background: var(--text3);
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* ── 목록 패널 ── */
#list-panel {
  position: fixed;
  top: var(--hh);
  left: 0;
  width: 320px;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 150;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
}

#list-panel.open {
  transform: translateX(0);
}

#list-content {
  flex: 1;
  overflow-y: auto;
}

.list-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.14s;
  position: relative;
}

.list-item:hover {
  background: var(--bg);
}

.list-item:hover::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.list-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-item .name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.list-stars {
  font-size: 11px;
  color: var(--gold);
  flex-shrink: 0;
}

.list-item .sub {
  color: var(--text3);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.list-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* 모바일 하단 시트 */
#list-handle {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  margin: 12px 16px 6px;
  min-height: 30px;
  flex-shrink: 0;
  cursor: default;
  position: relative;
}

#handle-left-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}


#list-handle span {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  display: none;
}

#list-close-btn {
  display: none;
  position: absolute;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-size: 13px;
  cursor: pointer;
  color: var(--text3);
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

#list-close-btn:hover {
  background: transparent;
  color: var(--text);
}

#mobile-list-btn {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-pill);
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 145;
  white-space: nowrap;
  transition: all 0.18s;
  letter-spacing: -0.2px;
}

#mobile-list-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-lg);
}

#mobile-list-btn:active {
  transform: translateX(-50%) scale(0.97);
}

#list-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 148;
  backdrop-filter: blur(2px);
}

#list-backdrop.on {
  display: block;
}

@media (max-width: 768px) {
  #header-search {
    flex: unset;
    margin-right: 0;
  }

  #panel {
    height: 60vh;
    border-radius: 24px 24px 0 0;
  }

  #panel-handle {
    padding: 8px 0 6px;
    cursor: grab;
  }

  #panel-handle span {
    display: block;
  }

  #panel-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding-top: 0;
  }

  #toggle-list-btn {
    display: none;
  }

  #mobile-list-btn {
    display: flex;
    align-items: center;
    gap: 7px;
  }


  #list-handle {
    display: flex;
    justify-content: center;
    cursor: grab;
  }

  #handle-left-btns {
    position: absolute;
    left: 0px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #list-handle span {
    display: block;
  }

  #list-close-btn {
    display: flex;
  }

  #list-share-btn {
    position: absolute;
    right: calc(16px + 30px + 16px);
    top: 50%;
    transform: translateY(-50%);
  }

  #list-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 52vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    box-shadow: var(--shadow-up);
    overflow: hidden;
    border-right: none;
  }

  #list-panel.open {
    transform: translateY(0);
  }

  #list-content {
    overflow-y: auto;
  }

}

/* ── 필터 패널 헤더 ── */
#list-panel-header {
  padding: 4px 16px 22px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  background: transparent;
}

#filter-edit-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text2);
  font-weight: 600;
  transition: all 0.18s;
  font-family: inherit;
}

#filter-edit-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#filter-edit-btn.open {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

#filter-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chip {
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}

.filter-chip:hover {
  background: var(--primary-dim);
}

#filter-edit-panel {
  display: none;
}

#filter-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 0 2px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text2);
  font-weight: 600;
  transition: all 0.18s;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 110, 247, 0.25);
}

#star-filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 0 2px;
  flex-wrap: wrap;
}

.star-filter-btn {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text2);
  transition: all 0.18s;
  font-family: inherit;
  font-weight: 500;
}

.star-filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-light);
}

.star-filter-btn.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  font-weight: 700;
}

#recommended-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.recommended-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.recommended-tag-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-light);
}

.recommended-tag-btn.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.recommended-desc {
  font-size: 11px;
  color: var(--text3);
}

#subcat-filter-bar {
  display: none;
  gap: 4px;
  padding: 12px 0 2px;
  flex-wrap: wrap;
  align-items: center;
}

#subcat-filter-bar.visible {
  display: flex;
}

.subcat-btn {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text2);
  transition: all 0.18s;
  font-family: inherit;
  font-weight: 500;
}

.subcat-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-light);
}

.subcat-btn.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  font-weight: 700;
}

.edit-cat-icon-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text2);
  transition: all 0.18s;
  font-family: inherit;
}

.edit-cat-icon-btn:hover {
  background: var(--border-light);
  border-color: var(--text3);
}

/* ── 검색 패널 (결과 드롭다운) ── */
#search-panel {
  position: fixed;
  top: var(--hh);
  left: 0;
  z-index: 160;
  width: 260px;
  max-height: 60vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  top: 50px;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

#search-panel.open {
  opacity: 1;
  transform: translateY(8px);
  pointer-events: auto;
}

#search-results {
  overflow-y: auto;
  max-height: 60vh;
}

/* ── 빠른 카테고리 버블 ── */
.quick-cat-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-light);
}

.quick-cat-row::-webkit-scrollbar {
  display: none;
}

.quick-cat-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s, border-color 0.13s;
}

.quick-cat-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── 재검색 버튼 ── */
#research-btn {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 9px 20px;
  border-radius: 24px;
  border: none;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.15s, background 0.15s;
}

#research-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.14s;
}

.search-result-item:hover {
  background: var(--bg);
}

.search-result-item .info {
  flex: 1;
}

.search-result-item .name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.2px;
}

.search-result-item .sub {
  color: var(--text3);
  font-size: 12px;
  margin-top: 3px;
}

.add-btn {
  padding: 8px 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.18s;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.add-btn:hover {
  background: #047857;
}

.add-btn:disabled {
  background: var(--text3);
  cursor: default;
  box-shadow: none;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: #3182f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ── 지도 오버레이 ── */
.map-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.overlay-star {
  font-size: 9px;
  color: var(--gold);
  min-height: 14px;
  text-align: center;
  line-height: 1;
  background: rgba(255, 255, 255, 0.96);
  padding: 1px 6px;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.overlay-emoji {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

.overlay-name {
  font-size: 11px;
  font-weight: 800;
  color: #1A1D2E;
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  margin-top: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(4px);
  letter-spacing: -0.2px;
}

.search-overlay {
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-overlay .overlay-emoji {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

.search-overlay .overlay-name {
  font-size: 11px;
  font-weight: 800;
  color: #1A1D2E;
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  margin-top: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(4px);
}

/* ── 클러스터 ── */
.cluster-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  user-select: none;
}

.cluster-branches {
  border-left: 2px solid rgba(79, 110, 247, 0.3);
  padding: 3px 0;
  margin-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cluster-row {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.cluster-row::before {
  content: '';
  display: block;
  width: 10px;
  height: 2px;
  background: rgba(79, 110, 247, 0.3);
  flex-shrink: 0;
}

.cluster-label {
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: all 0.15s;
  letter-spacing: -0.2px;
  backdrop-filter: blur(4px);
}

.cluster-row:hover .cluster-label {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-dim);
}

.cluster-stem {
  width: 2px;
  height: 6px;
  background: rgba(79, 110, 247, 0.3);
  margin-left: 14px;
}

.cluster-base {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
}

/* ── 토스트 ── */
#nearby-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  display: none;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── 설정 패널 ── */
#settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-up);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 70vh;
  overflow-y: auto;
  z-index: 200;
}

#settings-panel.open {
  transform: translateY(0);
}

#settings-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 6px;
  min-height: 36px;
  flex-shrink: 0;
  cursor: grab;
  position: sticky;
  top: 0;
  z-index: 1;
}

#settings-handle span {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  display: block;
}

#settings-content {
  padding: 4px 24px 36px;
}

#settings-content-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 18px;
}

#settings-content-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

#settings-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
}

#settings-close:hover {
  background: transparent;
  color: var(--text);
  transform: translateY(-50%) scale(1.08);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.settings-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.6;
}

.settings-action-btn {
  flex-shrink: 0;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.18s;
  white-space: nowrap;
  font-family: inherit;
}

.settings-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ── 태그 ── */
.place-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  border: 1.5px solid var(--primary-dim);
  letter-spacing: -0.1px;
}

/* ── 내 위치 버튼 ── */
#my-location-btn {
  position: fixed;
  right: 18px;
  background: var(--surface);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 144;
  transition: opacity 0.18s cubic-bezier(0.32, 0.72, 0, 1), transform 0.18s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.18s cubic-bezier(0.32, 0.72, 0, 1);
  bottom: 18px;
}

#my-location-btn:hover {
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(79, 110, 247, 0.15);
  transform: scale(1.06);
}

#my-location-btn:active {
  transform: scale(0.93);
}

#my-location-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── 줌 배지 ── */
#zoom-badge {
  position: fixed;
  right: 44px;
  top: calc(var(--hh) + 8px);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  z-index: 100;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  backdrop-filter: blur(8px);
  letter-spacing: 0.2px;
}

/* ── 목록 아이템 드롭다운 ── */
.list-item-actions {
  position: relative;
  flex-shrink: 0;
}

.list-menu-btn {
  background: none;
  border: none;
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text3);
  border-radius: 6px;
  line-height: 1;
  transition: all 0.14s;
}

.list-menu-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.list-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  min-width: 96px;
  overflow: hidden;
  margin-top: 4px;
}

.list-menu.open {
  display: block;
}

.list-menu-item {
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  display: block;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.12s;
}

.list-menu-item:hover {
  background: var(--bg);
}

.list-menu-item.delete {
  color: var(--red);
  font-weight: 600;
}

/* ── 편집 모드 (서브카테고리/태그) ── */
.subcat-edit-item,
.tag-edit-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  margin: 2px 3px 2px 0;
  background: var(--bg);
  font-size: 12px;
}

.subcat-icon-edit,
.tag-icon-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  border-radius: 4px;
  min-width: 16px;
  text-align: center;
}

.subcat-icon-edit:hover,
.tag-icon-edit:hover {
  background: var(--border-light);
}

.subcat-edit-name,
.tag-edit-name {
  color: var(--text2);
  padding: 0 2px;
  font-weight: 500;
}

.subcat-edit-btn,
.tag-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 4px;
  font-size: 11px;
  color: var(--text3);
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
}

.subcat-edit-btn:hover,
.tag-edit-btn:hover {
  background: var(--border-light);
  color: var(--text);
}

.subcat-edit-btn.del,
.tag-edit-btn.del {
  color: var(--red);
}

.subcat-add-btn,
.tag-add-btn {
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1.5px dashed var(--primary);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  color: var(--primary);
  margin: 2px 3px 2px 0;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s;
}

.subcat-add-btn:hover,
.tag-add-btn:hover {
  background: var(--primary-light);
}

.subcat-edit-done,
.tag-edit-done {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--primary);
  font-size: 12px;
  cursor: pointer;
  color: #fff;
  margin: 2px 0;
  font-family: inherit;
  font-weight: 700;
  box-shadow: var(--shadow-primary);
}

.subcat-edit-toggle,
.tags-edit-toggle {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: none;
  font-size: 11px;
  cursor: pointer;
  color: var(--text3);
  margin-left: 3px;
  font-family: inherit;
}

.subcat-edit-toggle:hover,
.tags-edit-toggle:hover {
  border-color: var(--text2);
  color: var(--text2);
}

.edit-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 12px;
  color: var(--text3);
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
}

.edit-icon-btn:hover {
  background: var(--border-light);
  color: var(--text);
}

/* ── 저장 태그 선택 모달 ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modal-up 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes modal-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h3 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: left;
  letter-spacing: -0.4px;
}

.modal-content p {
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 20px;
  font-weight: 500;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.picker-item {
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text2);
}

.picker-item:hover {
  border-color: var(--primary-dim);
  background: var(--primary-light);
  color: var(--primary);
}

.picker-item.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.modal-footer {
  display: flex;
  gap: 10px;
}

.modal-footer button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  letter-spacing: -0.2px;
}

#save-picker-cancel {
  background: var(--bg);
  color: var(--text2);
}

#save-picker-cancel:hover {
  background: var(--border-light);
}

#save-picker-confirm {
  background: var(--primary);
  color: #fff;
}

#save-picker-confirm:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

#save-picker-confirm:disabled {
  background: var(--text3);
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Share modal */
.share-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary, #3B82F6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.share-place-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.share-place-item:last-child {
  border-bottom: none;
}

.share-place-name {
  font-weight: 700;
  font-size: 15px;
}

.share-place-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

#share-confirm-btn {
  background: var(--primary, #3B82F6);
  color: #fff;
}

/* ── 지도 공유 팝업 ── */
#list-share-btn {
  flex-shrink: 0;
  margin-left: auto;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.18s;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

#list-share-btn:hover {
  background: var(--primary);
  color: #fff;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.share-modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: transparent;
  color: var(--text);
}

.share-section {
  margin-bottom: 20px;
}

.share-section:last-child {
  margin-bottom: 0;
}

.share-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: monospace;
  color: var(--text2);
  background: var(--bg);
  outline: none;
}

.share-link-row input:focus {
  border-color: var(--primary);
}

.share-link-row button {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.share-link-row button:hover {
  background: var(--primary-hover);
}

.share-link-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.share-section-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}

.share-cat-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  cursor: pointer;
}

.share-cat-select:focus {
  border-color: var(--primary);
}

/* 드래그 핸들 */
.drag-handle {
  cursor: grab;
  color: var(--text3);
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
  flex-shrink: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.subcat-edit-item.dragging {
  opacity: 0.4;
}

.subcat-edit-item.drag-over {
  outline: 2px dashed var(--primary);
  border-radius: var(--radius-sm);
}

/* 공유받은 태그 */
.filter-btn.shared-cat-btn {
  border-style: dashed;
  border-color: var(--primary-dim);
}

.shared-tag-item {
  opacity: 0.7;
  cursor: default !important;
}

.shared-tag-label {
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
  margin-left: 2px;
}