/* 우리의 데이트 지도 — 아이보리·연분홍·코랄·라벤더. 지도 위 요소는 작고 둥글게, 지도 조작·지명은 가리지 않게 */
:root {
  --ivory: #fff9f2;
  --pink: #ffe3e8;
  --pink-2: #ffd0da;
  --coral: #ff7a66;
  --coral-d: #e8604c;
  --lav: #9d8cf0;
  --lav-soft: #efeafe;
  --food: #ff7a66;   /* 맛집 = 코랄 */
  --cafe: #f28cab;   /* 카페 = 진분홍 */
  --play: #9d8cf0;   /* 놀거리 = 라벤더 */
  --unknown: #a3a0a8;
  --act: var(--play);
  --bg: #fff9f2;
  --card: #fffdfa;
  --fg: #3b2f33;
  --muted: #8a7d82;
  --line: #f1e4e2;
  --soft: #fbf1ee;
  --warn-bg: #fff1dc;
  --warn-fg: #8a5300;
  --ok-bg: #e8f6ec;
  --ok-fg: #276b3d;
  --shadow: 0 6px 22px rgba(120, 70, 80, 0.16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  font-size: 15px;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

.map { position: fixed; inset: 0; background: #f6efe9; }
.map-notice {
  position: fixed; left: 16px; right: 16px; top: calc(var(--safe-t) + 112px); z-index: 15;
  background: var(--warn-bg); color: var(--warn-fg); border-radius: 16px; padding: 12px 14px; font-size: 13px; line-height: 1.5;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  max-width: 560px; margin: 0 auto;
}

/* 상단: 제목 + 필터. 한 장의 둥근 카드로 묶어 지도 위 가림을 최소화 */
.top {
  position: fixed; top: calc(var(--safe-t) + 8px); left: 10px; right: 10px; z-index: 20;
  background: rgba(255, 249, 242, 0.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 20px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; max-width: 560px; margin: 0 auto;
}
.top-row { display: flex; align-items: center; gap: 6px; }
.title { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.3px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title .heart { color: var(--coral); font-size: 15px; }
.seg { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding-right: 6px; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 700;
  color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line);
}
.seg button.active { background: var(--coral); color: #fff; box-shadow: none; }
.seg button[data-filter="카페"].active { background: var(--cafe); }
.seg button[data-filter="놀거리"].active { background: var(--play); }
.seg button.active .dot { background: #fff !important; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.food { background: var(--food); }
.dot.cafe { background: var(--cafe); }
.dot.play, .dot.act { background: var(--play); }
.dot.unknown { background: var(--unknown); }
.pill {
  border: 0; border-radius: 999px; padding: 6px 10px; font-size: 12.5px; font-weight: 700;
  background: var(--lav-soft); color: #5a48b8; white-space: nowrap;
}
.pill.warn { background: var(--pink); color: #b03a52; }
.round {
  border: 0; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
  font-size: 17px; font-weight: 800; flex: 0 0 auto; color: var(--muted);
}

/* 하단: 목록 보기 + 추가 버튼 */
.bottom-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 14px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; max-width: 560px; margin: 0 auto;
}
.bottom-bar > * { pointer-events: auto; }
.list-btn {
  border: 0; border-radius: 999px; padding: 11px 16px; font-size: 14px; font-weight: 700; background: var(--card); color: var(--fg); box-shadow: var(--shadow);
}
.list-btn b { color: var(--coral-d); }
.fab {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; background: var(--coral); color: #fff;
  font-size: 28px; line-height: 1; box-shadow: 0 6px 18px rgba(232, 96, 76, 0.4);
}
.empty-chip {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 84px); z-index: 12;
  background: var(--card); border-radius: 999px; padding: 9px 14px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow);
  white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; border: 0;
}

/* 장소 목록 패널(필터와 연동) */
.list-panel {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--safe-b) + 10px); z-index: 24; max-height: 46dvh;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  animation: up 0.18s ease-out; max-width: 560px; margin: 0 auto;
}
.lp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 16px; }
.place-list { overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.pl-row {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; padding: 9px 8px; border-radius: 12px; width: 100%;
}
.pl-row:active { background: var(--soft); }
.pl-row .nm { font-weight: 700; font-size: 14.5px; }
.pl-row .ad { font-size: 12px; color: var(--muted); margin-top: 1px; }
.pl-row .grow { flex: 1; min-width: 0; }
.pl-row .grow > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-empty { padding: 8px 12px 14px; color: var(--muted); font-size: 13px; }
.pin-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; flex: 0 0 auto; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* 핀 카드 */
.place-card {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--safe-b) + 10px); z-index: 25;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 8px 16px 14px;
  max-height: 60dvh; overflow-y: auto; animation: up 0.2s ease-out; max-width: 560px; margin: 0 auto;
}
.place-card::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.pc-head { display: flex; align-items: flex-start; gap: 8px; }
.pc-title { font-size: 17px; font-weight: 700; line-height: 1.3; flex: 1; }
.pc-close { border: 0; background: var(--soft); width: 30px; height: 30px; border-radius: 50%; font-size: 16px; flex: 0 0 auto; }
.pc-sub { margin-top: 3px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-line { margin-top: 8px; font-size: 14px; line-height: 1.45; }
.pc-line .k { color: var(--muted); font-size: 12px; margin-right: 6px; }
.pc-reels { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.pc-reel {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; color: inherit;
  background: var(--soft); border-radius: 10px; padding: 9px 11px; font-size: 14px;
}
.pc-reel .who { color: var(--muted); font-size: 12px; }
.pc-reel .go { font-weight: 700; color: var(--coral-d); white-space: nowrap; }
.pc-reel .src-ic { font-size: 13px; }
.pc-actions .btn.primary { flex: 1.4; }
.pc-actions { margin-top: 12px; display: flex; gap: 8px; }
.pc-actions .btn { flex: 1; text-align: center; text-decoration: none; }

.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.food { background: #ffe8e3; color: #b8412f; }
.badge.cafe { background: #ffe3ec; color: #a8335a; }
.badge.act, .badge.play { background: var(--lav-soft); color: #5a48b8; }
.badge.st-received { background: #eef0f4; color: #4b5563; }
.badge.st-processing { background: var(--lav-soft); color: #5a48b8; }
.badge.st-needs_choice { background: var(--warn-bg); color: var(--warn-fg); }
.badge.st-confirmed { background: var(--ok-bg); color: var(--ok-fg); }
.badge.st-failed { background: #fde2e2; color: #a12a2a; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 11px 14px; font-size: 15px; font-weight: 600; color: var(--fg);
}
.btn.primary { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; }
.btn.small { padding: 7px 10px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; }
.btn.primary:disabled { background: var(--soft); color: var(--muted); border-color: var(--line); opacity: 1; }

/* 바텀시트 */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(59, 47, 51, 0.32); display: flex; align-items: flex-end; }
.sheet-card {
  background: var(--card); width: 100%; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(var(--safe-b) + 16px); display: flex; flex-direction: column; gap: 12px; animation: up 0.18s ease-out;
}
@media (min-width: 640px) {
  .sheet { align-items: center; justify-content: center; }
  .sheet-card { max-width: 480px; border-radius: 20px; }

}
.sh-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sh-head h2 { margin: 0; font-size: 18px; }
.sh-step { font-size: 12px; color: var(--muted); }
.sh-text { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.sh-actions { display: flex; gap: 8px; }
.sh-actions .btn { flex: 1; }
.sheet-card input[type="text"], .sheet-card input[type="url"], .sheet-card input[type="search"], .sheet-card textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; background: #fff; color: var(--fg);
}
.sheet-card textarea { min-height: 150px; resize: vertical; line-height: 1.45; }
.err { color: #c62828; font-size: 13px; margin: 0; }
.source { font-size: 13px; padding: 8px 10px; border-radius: 10px; line-height: 1.45; }
.source.auto { background: var(--ok-bg); color: var(--ok-fg); }
.source.manual { background: #eef2ff; color: #3730a3; }
.source.none { background: var(--warn-bg); color: var(--warn-fg); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > .lbl { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ev { font-size: 12px; color: #9096a0; line-height: 1.4; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 14px;
}
.chip.on { background: var(--coral); color: #fff; border-color: var(--coral); }
.chip.food.on { background: var(--food); border-color: var(--food); }
.chip.act.on { background: var(--act); border-color: var(--act); }
.chip.cand { border-style: dashed; }
details.cap summary { font-size: 13px; color: var(--muted); cursor: pointer; }
details.cap pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: var(--soft); padding: 10px; border-radius: 10px; margin: 6px 0 0; max-height: 200px; overflow: auto; }

.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }
.cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cand { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cand.sel { border-color: var(--fg); background: var(--soft); }
.cand .nm { font-weight: 700; font-size: 15px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cand .ad { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cand .ct { font-size: 12px; color: #9096a0; margin-top: 2px; }
.sticky-bottom { position: sticky; bottom: calc(-1 * var(--safe-b) - 16px); background: var(--card); padding: 10px 0 0; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.row .t { font-weight: 700; }
.row .m { font-size: 13px; color: var(--muted); }
.row .a { display: flex; gap: 6px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 112px); transform: translateX(-50%); z-index: 60;
  background: rgba(59, 47, 51, 0.92); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px);
}
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 8px 0; }

/* 게시물 검토 화면 */
.post-meta { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.warn-text { color: var(--warn-fg); }
.mstat { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.mstat.ok { color: var(--ok-fg); }
.mstat.warn { color: var(--warn-fg); }
.mstat input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--coral); }
button.cand { display: block; width: 100%; text-align: left; background: #fff; font: inherit; color: inherit; }
button.cand:active { background: var(--soft); }
.cands { display: flex; flex-direction: column; gap: 6px; }
.linkish { border: 0; background: none; padding: 0; }
.row.dim { opacity: 0.5; }
.rowbtn { text-align: left; background: #fff; font: inherit; color: inherit; width: 100%; }
.orig { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 4px 8px; }
.st-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* 새로고침 버튼 회전 */
#syncBtn.spin { animation: rfm-spin .8s linear infinite; }
@keyframes rfm-spin { to { transform: rotate(360deg); } }
.steps { padding-left: 18px; margin: 6px 0; }
.steps li { margin: 4px 0; }
.steps code { font-size: 12px; word-break: break-all; background: rgba(0,0,0,.05); padding: 0 3px; border-radius: 4px; }
