/* ── PWA: safe-area & 스플래시 ── */
:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* standalone(홈 화면 앱) 모드에서 노치·홈바 영역 확보 */
@media all and (display-mode: standalone) {
  .hud-header  { padding-top: calc(12px + var(--safe-top)); }
  .tab-bar     { padding-bottom: var(--safe-bottom); height: calc(var(--tab-h) + var(--safe-bottom)); }
  .sheet       { bottom: calc(var(--tab-h) + var(--safe-bottom)); }
  .toast       { bottom: calc(28px + var(--tab-h) + var(--safe-bottom)); }
  .btn-myloc   { bottom: calc(104px + var(--tab-h) + var(--safe-bottom)); }
  .zoom-ctrl   { bottom: calc(32px  + var(--tab-h) + var(--safe-bottom)); }
  .btn-fog     { bottom: calc(152px + var(--tab-h) + var(--safe-bottom)); }
  .fog-stats-pill { bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px); }
  .feed-view, .coll-view, .route-view {
    bottom: calc(var(--tab-h) + var(--safe-bottom));
  }
}

/* 스플래시: 앱 로딩 중 보이는 배경 (body 자체가 --bg) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  opacity: 1;
  transition: opacity .4s .2s ease;
  pointer-events: none;
}
body.ready::before { opacity: 0; }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:   #0a0a0f;
  --s1:   #111118;
  --s2:   #1a1a25;
  --s3:   #222230;
  --s4:   #2c2c3e;
  --bd:   rgba(255,255,255,.07);
  --bdm:  rgba(255,255,255,.12);
  --text: #f0f0f8;
  --t2:   #a0a0be;
  --tmut: #55556a;
  --acc:  #f97316;
  --acc2: #fb923c;
  --grad: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
  --shad: 0 8px 36px rgba(0,0,0,.65);
  --sm:   0 2px 10px rgba(0,0,0,.4);
  --r:    16px;
  --rs:   10px;
  --rx:   7px;
  --tab-h:    56px;
  --header-h: 64px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Noto Sans KR', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* ── MAP ── */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}


/* ── 로그인 화면 ── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-screen.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-logo {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-sub {
  font-size: 15px;
  color: var(--t2);
}

.btn-kakao {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 24px;
  background: #FEE500;
  border: none;
  border-radius: var(--rs);
  color: rgba(0,0,0,.85);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-kakao:hover { opacity: .88; }
.btn-kakao:active { transform: scale(.97); }
.btn-kakao.loading { opacity: .65; cursor: wait; pointer-events: none; }
.login-popup-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #ff6b6b;
  line-height: 1.5;
  text-align: center;
  min-height: 1em;
}

/* ── 헤더 HUD ── */
.hud-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  pointer-events: none;
}

.logo-pill {
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 8px 16px;
  pointer-events: auto;
  box-shadow: var(--sm);
}

.logo {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--s3);
  border: 1.5px solid var(--bdm);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  box-shadow: var(--sm);
  transition: border-color .2s, transform .15s;
  flex-shrink: 0;
}
.user-avatar:hover { border-color: var(--acc); transform: scale(1.06); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar.hidden { display: none; }

.profile-wrap { position: relative; }

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: rgba(17,17,24,.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bdm);
  border-radius: var(--r);
  box-shadow: var(--shad);
  padding: 16px;
  z-index: 400;
  animation: pmIn .15s ease;
}
.profile-menu.hidden { display: none; }
@keyframes pmIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.pm-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.pm-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--s3);
  border: 1.5px solid var(--bdm);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--text);
}
.pm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-info { display: flex; flex-direction: column; gap: 3px; }
.pm-name { font-size: 15px; font-weight: 700; color: var(--text); }
.pm-count { font-size: 12px; color: var(--t2); }

.pm-divider { height: 1px; background: var(--bd); margin-bottom: 10px; }

.pm-logout {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border-radius: var(--rx);
  background: none; border: none;
  color: #ff6b6b; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.pm-logout:hover { background: rgba(255,107,107,.12); }

.pin-badge {
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  pointer-events: auto;
  box-shadow: var(--sm);
}

/* ── 검색바 ── */
.search-wrap {
  position: fixed;
  top: 66px;
  left: 16px;
  right: 16px;
  z-index: 500;
  transition: opacity .2s;
}
.search-wrap.hidden { opacity: 0; pointer-events: none; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  box-shadow: var(--sm);
  transition: border-color .2s, box-shadow .2s;
}
.search-bar:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(249,115,22,.18);
}

.search-icon { flex-shrink: 0; color: var(--tmut); }

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-width: 0;
  -webkit-appearance: none;
}
#search-input::placeholder { color: var(--tmut); }
#search-input::-webkit-search-cancel-button { display: none; }

.btn-sc {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--s3);
  border: none;
  color: var(--t2);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.btn-sc:hover { background: var(--s4); }
.btn-sc.hidden { display: none; }

/* 드롭다운 */
.search-drop {
  margin-top: 6px;
  background: var(--s1);
  border: 1px solid var(--bdm);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shad);
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
}
.search-drop.hidden { display: none; }

.search-drop li {
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background .15s;
}
.search-drop li:last-child { border-bottom: none; }
.search-drop li:hover,
.search-drop li:active { background: var(--s2); }
.search-drop li.no-res {
  padding: 16px;
  color: var(--tmut);
  font-size: 13px;
  text-align: center;
  cursor: default;
  align-items: center;
}
.search-drop li.no-res:hover { background: transparent; }

.res-name { font-size: 14px; font-weight: 600; color: var(--text); }
.res-full {
  font-size: 12px;
  color: var(--tmut);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── 추가 모드 배너 ── */
.add-banner {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  background: var(--s1);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shad);
  animation: dropIn .25s ease-out;
}
.add-banner.hidden { display: none; }

.add-banner button {
  background: var(--s3);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--t2);
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
}
.add-banner button:hover { background: var(--s4); }

@keyframes dropIn {
  from { transform: translateX(-50%) translateY(-10px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);     opacity: 1; }
}

/* ── FAB ── */
.btn-fab {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 300;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(249,115,22,.5);
  transition: transform .2s, box-shadow .2s, background .25s;
  -webkit-tap-highlight-color: transparent;
}
.btn-fab:hover { transform: scale(1.07); }
.btn-fab:active { transform: scale(.93); }
.btn-fab.is-cancel {
  background: var(--s3);
  box-shadow: 0 4px 18px rgba(0,0,0,.4);
}

/* ── 내 위치 ── */
.btn-myloc {
  position: fixed;
  right: 16px;
  bottom: calc(104px + var(--tab-h));
  z-index: 200;
  width: 40px;
  height: 40px;
  background: rgba(10,10,15,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bdm);
  border-radius: var(--rx);
  color: var(--t2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--sm);
  transition: color .2s, background .2s, bottom .35s cubic-bezier(.32,0,.15,1);
}
.btn-myloc:hover { color: var(--acc); }

/* ── 줌 컨트롤 ── */
.zoom-ctrl {
  position: fixed;
  right: 16px;
  bottom: calc(32px + var(--tab-h));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: bottom .35s cubic-bezier(.32,0,.15,1);
}

.btn-zoom {
  width: 40px;
  height: 40px;
  background: rgba(10,10,15,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bdm);
  color: var(--text);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sm);
  transition: background .2s;
}
.btn-zoom:first-child { border-radius: var(--rx) var(--rx) 0 0; }
.btn-zoom:last-child  { border-radius: 0 0 var(--rx) var(--rx); }
.btn-zoom:hover { background: rgba(34,34,48,.95); }
.btn-zoom:active { background: var(--s3); }

/* 시트 열렸을 때 UI 버튼들 올리기 */
.zoom-ctrl.lifted  { bottom: calc(var(--tab-h) + var(--sheet-h, 320px) + 16px); }
.btn-myloc.lifted  { bottom: calc(var(--tab-h) + var(--sheet-h, 320px) + 64px); }

/* ── 핀 마커 ── */
.map-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 3px 7px rgba(0,0,0,.55));
  cursor: pointer;
  transition: filter .15s;
}
.map-pin:hover { filter: drop-shadow(0 4px 12px rgba(0,0,0,.7)); }

.pin-bub {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pc, #8b5cf6);
  border: 2.5px solid rgba(255,255,255,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s;
}

.pin-emoji {
  transform: rotate(45deg);
  font-size: 16px;
  line-height: 1;
  display: block;
}
.pin-paw {
  transform: rotate(45deg);
  display: block;
  flex-shrink: 0;
}

/* 활성 핀 */
.map-pin.is-active .pin-bub {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 0 0 3px rgba(255,255,255,.2),
              0 0 18px var(--pc, #8b5cf6);
}

/* 임시(배치 중) 핀 */
.map-pin.pin-temp .pin-bub {
  background: linear-gradient(135deg, #f97316, #fbbf24);
  border: 2px dashed rgba(255,255,255,.5);
  animation: pulse-pin .75s ease-in-out infinite alternate;
}
@keyframes pulse-pin {
  from { transform: rotate(-45deg) scale(.95); }
  to   { transform: rotate(-45deg) scale(1.1); }
}

/* 지도 커서 (추가 모드) */
#map.add-mode { cursor: crosshair !important; }


/* ── 바텀시트 ── */
.sheet {
  position: fixed;
  bottom: var(--tab-h);
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--s1);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 40px rgba(0,0,0,.65);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,0,.15,1);
  pointer-events: none;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.sheet.is-open {
  transform: translateY(0);
  pointer-events: auto;
}

.sheet-drag {
  flex-shrink: 0;
  padding: 12px 0 4px;
  display: flex;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.sheet-drag:active { cursor: grabbing; }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--s4);
  border-radius: 2px;
}

/* ── 시트 패널 ── */
.s-panel {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 20px 40px;
  overscroll-behavior: contain;
}
.s-panel.hidden { display: none; }

/* 뷰 패널 */
.sv-toprow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
}

.sv-cat {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 50px;
  border: 1px solid currentColor;
}

.sv-name {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 5px;
}

.sv-addr {
  font-size: 12px;
  color: var(--tmut);
  line-height: 1.5;
  margin-bottom: 16px;
}

.sv-media {
  border-radius: var(--rs);
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}
.sv-media:empty { display: none; }
.sv-media iframe,
.sv-media video {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
}

.sv-meta { margin-bottom: 18px; }
.sv-date {
  display: block;
  font-size: 12px;
  color: var(--tmut);
  margin-bottom: 8px;
}
.sv-memo {
  font-size: 14px;
  color: var(--t2);
  line-height: 1.65;
  white-space: pre-wrap;
}

.sv-btns {
  display: flex;
  gap: 8px;
}

.sv-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 10px;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  color: var(--t2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background .2s, color .2s;
}
.sv-btn:hover { background: var(--s3); color: var(--text); }
.sv-del:hover { color: #f87171 !important; border-color: rgba(248,113,113,.25) !important; }

/* 추가 패널 */
.sa-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sa-toprow h3 { font-size: 18px; font-weight: 700; }

.btn-sx {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--s2);
  border: none;
  color: var(--t2);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.btn-sx:hover { background: var(--s3); color: var(--text); }

/* 입력 필드 */
.s-inp {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--bdm);
  border-radius: var(--rs);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  outline: none;
  color-scheme: dark;
}
.s-inp::placeholder { color: var(--tmut); }
.s-inp:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

.s-ta {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.add-addr-hint {
  font-size: 12px;
  color: var(--tmut);
  margin: -6px 0 12px;
  padding: 0 3px;
  min-height: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 카테고리 필 */
.cat-pills {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.cat-pills::-webkit-scrollbar { display: none; }

.cat-pill {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 50px;
  border: 1px solid var(--bdm);
  background: var(--s2);
  color: var(--t2);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all .2s;
}
.cat-pill.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}

/* 영상 탭 */
.s-tabs {
  display: flex;
  gap: 3px;
  background: var(--s2);
  border-radius: var(--rs);
  padding: 4px;
  margin-bottom: 12px;
}
.s-tab {
  flex: 1;
  padding: 8px 5px;
  border: none;
  border-radius: var(--rx);
  background: transparent;
  color: var(--tmut);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.s-tab.active { background: var(--s4); color: var(--text); }

.s-tabp { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.s-tabp.hidden { display: none; }

.s-mprev {
  border-radius: var(--rs);
  overflow: hidden;
  background: #000;
}
.s-mprev:empty { display: none; }
.s-mprev iframe,
.s-mprev video {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
}

/* 업로드존 */
.s-upzone {
  border: 2px dashed var(--bdm);
  border-radius: var(--rs);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  cursor: pointer;
  color: var(--tmut);
  font-size: 13px;
  transition: all .2s;
}
.s-upzone:hover,
.s-upzone.drag-over {
  border-color: var(--acc);
  background: rgba(249,115,22,.05);
  color: var(--t2);
}
.s-upzone .hint { font-size: 11px; }

/* 카메라 버튼 */
.btn-cam {
  width: 100%;
  padding: 22px;
  background: var(--s2);
  border: 1px solid var(--bdm);
  border-radius: var(--rs);
  color: var(--t2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  font-family: inherit;
  transition: background .2s, color .2s;
}
.btn-cam:hover { background: var(--s3); color: var(--text); }

/* 업로드 완료 프리뷰 */
.upl-done { position: relative; }
.upl-done video { width: 100%; aspect-ratio: 16/9; display: block; background: #000; border-radius: var(--rs); }
.upl-done .upl-meta { padding: 7px 12px; font-size: 11px; color: var(--tmut); }
.btn-clr {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* 추가 패널 버튼 */
.sa-btns { display: flex; gap: 10px; margin-top: 4px; }

.btn-cancel {
  flex: 1;
  padding: 13px;
  background: var(--s2);
  border: 1px solid var(--bdm);
  border-radius: var(--rs);
  color: var(--t2);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
}
.btn-cancel:hover { background: var(--s3); }

.btn-save {
  flex: 2;
  padding: 13px;
  background: var(--grad);
  border: none;
  border-radius: var(--rs);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s;
}
.btn-save:hover { opacity: .88; }
.btn-save:disabled { opacity: .4; cursor: not-allowed; }

/* ── 토스트 ── */
.toast {
  position: fixed;
  bottom: calc(28px + var(--tab-h));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--s3);
  color: var(--text);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shad);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* ── 스피너 ── */
.spin {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 2px; }

/* ── 데스크톱 ── */
@media (min-width: 520px) {
  .sheet {
    --tx: -50%;
    left: 50%;
    right: auto;
    width: 520px;
    transform: translateX(var(--tx, 0)) translateY(100%);
  }
  .sheet.is-open {
    transform: translateX(var(--tx, 0)) translateY(0);
  }
}

/* ── 탭 바 ── */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 600;
  height: var(--tab-h);
  background: rgba(10,10,15,.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bdm);
  display: flex;
  align-items: stretch;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--tmut);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .4px;
  cursor: pointer;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn svg { transition: transform .2s; }
.tab-btn.active { color: var(--acc); }
.tab-btn.active svg { transform: scale(1.12); }

/* ── 피드 뷰 ── */
.feed-view {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--tab-h);
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.feed-view.hidden { display: none; }

/* 지역 필터 칩 */
.region-chips {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--bd);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.region-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 50px;
  border: 1px solid var(--bdm);
  background: var(--s2);
  color: var(--t2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all .2s;
}
.chip.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}
.chip:not(.active):hover { background: var(--s3); }

/* 피드 리스트 */
.feed-list {
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.feed-empty {
  text-align: center;
  color: var(--tmut);
  font-size: 14px;
  padding: 60px 20px;
}

/* 지역 섹션 */
.fs { display: flex; flex-direction: column; gap: 10px; }

.fs-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bd);
}

.fs-region { font-size: 15px; font-weight: 700; color: var(--text); }
.fs-count  { font-size: 12px; color: var(--tmut); }

/* 피드 카드 */
.fc {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: background .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.fc:hover  { background: var(--s2); }
.fc:active { transform: scale(.985); }

.fc-media { line-height: 0; background: #000; }
.fc-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.fc-vid-icon {
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--tmut);
  font-size: 12px;
}

.fc-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fc-top-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fc-cat    { font-size: 11px; font-weight: 700; }
.fc-coll   { font-size: 11px; color: var(--acc2); font-weight: 600; }
.fc-name   { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.fc-addr   { font-size: 12px; color: var(--tmut); }
.fc-date   { font-size: 12px; color: var(--tmut); margin-top: 2px; }
.fc-author { font-size: 11px; color: var(--tmut); margin-top: 4px; }
.fc-memo {
  font-size: 13px;
  color: var(--t2);
  margin-top: 2px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 컬렉션 뷰 ── */
.coll-view {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--tab-h);
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.coll-view.hidden { display: none; }

.coll-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bd);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.coll-title { font-size: 17px; font-weight: 700; }

.btn-coll-new {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: var(--grad);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s;
}
.btn-coll-new:hover { opacity: .86; }

.coll-list {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coll-empty {
  text-align: center;
  color: var(--tmut);
  font-size: 14px;
  line-height: 1.7;
  padding: 60px 20px;
}

.coll-item {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ci-body { flex: 1; min-width: 0; }
.ci-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.ci-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--tmut);
}
.ci-badge {
  background: rgba(14,165,233,.15);
  color: var(--acc2);
  border-radius: 50px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.ci-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ci-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--rx);
  border: 1px solid var(--bdm);
  background: var(--s2);
  color: var(--t2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.ci-btn:hover    { background: var(--s3); color: var(--text); }
.ci-share:hover  { color: var(--acc2); border-color: rgba(14,165,233,.3); }
.ci-del:hover    { color: #f87171; border-color: rgba(248,113,113,.25); }
.ci-leave:hover  { color: #fbbf24; border-color: rgba(251,191,36,.25); }

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--s1);
  border: 1px solid var(--bdm);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shad);
  animation: pmIn .18s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.invite-msg {
  font-size: 14px;
  color: var(--t2);
  line-height: 1.65;
  margin-bottom: 20px;
}
.invite-msg strong { color: var(--text); }

/* ── 컬렉션 셀렉터 ── */
.s-sel {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2355556a'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── 프로필 스트릭 ── */
.pm-streak {
  font-size: 11px;
  font-weight: 700;
  color: var(--acc2);
  min-height: 1em;
}

/* ── 단골 산책로 뱃지 ── */
.fc-regular {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.3);
  border-radius: 50px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* ── 산책 카드 (피드) ── */
.feed-section-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--tmut);
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 4px 0 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--bd);
}

.wc {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  overflow: hidden;
}

.wc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
}

.wc-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--s3);
  border: 1.5px solid var(--bdm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.wc-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wc-name { font-size: 14px; font-weight: 700; color: var(--text); }
.wc-date { font-size: 11px; color: var(--tmut); }

.wc-del {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--tmut); font-size: 13px;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.wc-del:hover { background: rgba(248,113,113,.15); color: #f87171; }

.wc-photo {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  overflow: hidden;
}

.wc-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wc-stats {
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wc-footer {
  padding: 0 10px 10px;
  border-top: 1px solid var(--bd);
  padding-top: 8px;
}

.wc-like {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: none;
  border: 1px solid var(--bd);
  border-radius: 50px;
  color: var(--tmut);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.wc-like:hover  { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); }
.wc-like:active { transform: scale(.93); }
.wc-like.liked  {
  border-color: rgba(239,68,68,.4);
  color: var(--text);
}

.wc-like-cnt { font-size: 13px; font-weight: 600; }

/* ── 산책 인증 모달 ── */
.rp-card {
  max-width: 420px;
}

.rp-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 10px 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--bd);
  margin-bottom: 16px;
}

.rp-body {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 16px;
}

.rp-no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
}
.rp-no-photo.hidden { display: none; }

.rp-hint {
  font-size: 13px;
  color: var(--tmut);
  text-align: center;
}

.rp-photo-btns {
  display: flex;
  gap: 10px;
}

.rp-btn {
  flex: 1;
  padding: 12px 16px;
  background: var(--s2);
  border: 1px solid var(--bdm);
  border-radius: var(--rs);
  color: var(--t2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.rp-btn:hover { background: var(--s3); color: var(--text); }

.rp-preview {
  position: relative;
  border-radius: var(--rs);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}
.rp-preview.hidden { display: none; }

.rp-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.rp-clear {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
}

/* ── 안개지도 ── */
.fog-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}
.fog-canvas.hidden { display: none; }

.btn-fog {
  position: fixed;
  right: 16px;
  bottom: calc(152px + var(--tab-h));
  z-index: 200;
  width: 40px; height: 40px;
  background: rgba(10,10,15,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bdm);
  border-radius: var(--rx);
  color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--sm);
  transition: color .2s, background .2s, border-color .2s,
              bottom .35s cubic-bezier(.32,0,.15,1);
}
.btn-fog:hover   { color: var(--acc); }
.btn-fog.active  {
  background: rgba(249,115,22,.2);
  border-color: var(--acc);
  color: var(--acc);
}
.btn-fog.lifted  { bottom: calc(var(--tab-h) + var(--sheet-h, 320px) + 112px); }
.btn-fog.hidden  { display: none; }

.fog-stats-pill {
  position: fixed;
  bottom: calc(var(--tab-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 201;
  background: rgba(10,10,15,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bdm);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--sm);
}
.fog-stats-pill.hidden { display: none; }

/* ── 경로 뷰 ── */
.route-view {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--tab-h);
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.route-view.hidden { display: none; }

.rv-recording-hud {
  background: var(--s1);
  border: 1.5px solid var(--acc);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.rv-recording-hud.hidden { display: none; }

.rv-rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: pulse-rec .9s ease-in-out infinite alternate;
}
@keyframes pulse-rec {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: .35; transform: scale(.65); }
}

.rv-stats {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rv-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rv-stat-val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}

.rv-stat-lbl {
  font-size: 10px;
  color: var(--tmut);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.rv-stat-sep {
  font-size: 18px;
  color: var(--s4);
  align-self: center;
}

.btn-stop-route {
  padding: 10px 16px;
  background: #ef4444;
  border: none;
  border-radius: var(--rs);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: opacity .2s, transform .15s;
}
.btn-stop-route:hover  { opacity: .85; }
.btn-stop-route:active { transform: scale(.95); }

.rv-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 20px;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r);
}
.rv-start.hidden { display: none; }

.btn-start-route {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--grad);
  border: none;
  border-radius: var(--rs);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s, transform .15s;
}
.btn-start-route:hover  { opacity: .88; }
.btn-start-route:active { transform: scale(.96); }

.rv-hint {
  text-align: center;
  font-size: 13px;
  color: var(--tmut);
  line-height: 1.65;
}

.rv-divider {
  font-size: 11px;
  font-weight: 700;
  color: var(--tmut);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bd);
}

.rv-empty {
  text-align: center;
  color: var(--tmut);
  font-size: 14px;
  padding: 32px 20px;
}

.rv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rv-card {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: pointer;
  transition: background .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.rv-card:hover  { background: var(--s2); }
.rv-card:active { transform: scale(.985); }

.rv-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rv-card-date {
  font-size: 12px;
  color: var(--tmut);
  font-weight: 500;
}

.rv-card-del {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--tmut);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.rv-card-del:hover {
  background: rgba(248,113,113,.15);
  color: #f87171;
}

.rv-card-stats {
  display: flex;
  gap: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* 경로 기록 중 탭 표시 */
#tab-route.recording { position: relative; }
#tab-route.recording::after {
  content: '';
  position: absolute;
  top: 10px; right: 12px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse-rec .9s ease-in-out infinite alternate;
}
