/* 맛집 노트 — 대한민국 지도 × 메신저 맛집 노트 */
:root {
  --bg: #fdfbf7;
  --panel: #ffffff;
  --ink: #202836;
  --ink-2: #4a5568;
  --muted: #8a94a3;
  --line: #eae5dc;
  --line-soft: #f1ede6;
  --accent: #ff5a2b;
  --accent-ink: #b93a12;
  --accent-soft: #ffe8df;
  --sea-1: #f7fbff;
  --sea-2: #e4effa;
  --land: #cfdff0;
  --land-hover: #b9d3ee;
  --land-active: #ffd9c8;
  --bubble: #ffffff;
  --chat-bg: #f7f4ee;
  --shadow-sm: 0 1px 2px rgba(24, 39, 62, .06), 0 2px 8px rgba(24, 39, 62, .05);
  --shadow-md: 0 6px 24px rgba(24, 39, 62, .10);
  --shadow-lg: 0 24px 60px rgba(24, 39, 62, .16);
  --r: 14px;
  --topbar-h: 64px;
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
          "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--bg);
}

/* ---------- top bar ---------- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, .92);
  backdrop-filter: blur(10px);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.brand-text { min-width: 0; }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p b { color: var(--ink-2); }

.topbar-actions { position: relative; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  transition: background .15s, transform .15s, color .15s;
}
.icon-btn:hover { background: #fff8f2; color: var(--accent-ink); }
.icon-btn:active { transform: scale(.96); }
.icon-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: #ffc9b5; color: var(--accent-ink); }

.menu {
  position: fixed; top: 64px; right: 16px; width: 262px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-md);
  padding: 8px; z-index: 60;
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 10px 11px;
  border: 0; border-radius: 10px; background: none;
  font-size: 13.5px; text-align: left;
}
.menu button:hover { background: #fbf7f1; }
.menu .menu-link {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 10px 11px; margin: 0;
  border: 0; border-radius: 10px; background: none;
  font-size: 13.5px; line-height: 1.4; text-align: left;
  color: var(--ink); text-decoration: none;
}
.menu .menu-link:hover { background: #fbf7f1; }
.menu button.danger { color: #c0392b; }
.menu-note {
  margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; line-height: 1.5; color: var(--muted);
}

/* ---------- layout ---------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(380px, .78fr) minmax(400px, 1.22fr);
  gap: 0;
}

/* ---------- map ---------- */
.map-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(90% 70% at 50% 8%, var(--sea-1) 0%, var(--sea-2) 60%, #dfeaf6 100%);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 6px 4px 0;
}
.map-fit { position: relative; }
#map { display: block; width: 100%; height: 100%; overflow: visible; position: relative; z-index: 1; }
#g-regions { filter: drop-shadow(0 3px 6px rgba(30, 60, 100, .10)); }

.region path {
  fill: var(--land);
  stroke: #ffffff;
  stroke-width: 1.6;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill .18s ease, opacity .18s ease;
}
.region:hover path,
.region.is-hover path { fill: var(--land-hover); }
.region.is-active path { fill: var(--land-active); stroke: #fff; stroke-width: 1.6; }
.region.is-active .active-stroke {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linejoin: round;
  pointer-events: none;
}
.region:focus { outline: none; }
.region:focus-visible path { stroke: var(--accent); stroke-width: 2; }
.inset-box {
  fill: rgba(255, 255, 255, .72);
  stroke: #b9cde3;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  rx: 10px;
}
.inset .region path { fill: var(--land); stroke: #fff; stroke-width: 1; }
.inset .region:hover path, .inset .region.is-hover path { fill: var(--land-hover); }
.inset .region.is-active path { fill: var(--land-active); }
.leader-line { stroke: #a9bed6; stroke-width: 1.1; stroke-dasharray: 3 3; fill: none; }
.seoul-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.inset-note { fill: #93a5b8; font-size: 9px; letter-spacing: .02em; }
.inset-cap { fill: #6b7d90; font-size: 11px; font-weight: 700; }

/* labels (HTML overlay, crisp at every size) */
.map-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px 2px 8px;
  background: rgba(255, 255, 255, .93);
  border: 1px solid rgba(32, 40, 54, .09);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(24, 39, 62, .10);
  font-size: 11.5px; font-weight: 700; line-height: 1.2;
  color: #2c3849; white-space: nowrap;
  cursor: pointer; pointer-events: auto;
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
.map-label .lines { display: block; text-align: center; }
.map-label:hover { background: #fff; transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 4px 14px rgba(24, 39, 62, .16); }
.map-label.is-active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(255, 90, 43, .35); }
.map-label .badge {
  display: inline-grid; place-items: center;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 9.5px; font-weight: 800;
}
.map-label.is-active .badge { background: #fff; color: var(--accent-ink); }
.map-label .badge.zero { background: #e6eaf0; color: #93a0b1; }
.map-label.seoul-label { font-size: 11px; }
.map-label.inset-label { font-size: 11.5px; padding: 3px 7px; }
.map-label.inset-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.map-foot {
  flex: 0 0 auto;
  padding: 6px 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.map-hint {
  margin: 0; font-size: 12.5px; color: #6b7d90;
  background: rgba(255, 255, 255, .7);
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .8);
  backdrop-filter: blur(6px);
}
.chips { display: none; }
.map-legal {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: #9aa3b0; letter-spacing: .01em;
}
.map-legal a { color: #6b7d90; text-decoration: none; font-weight: 600; }
.map-legal a:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- room ---------- */
.room {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--chat-bg);
  position: relative;
}
.room-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.back-btn {
  display: none;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 7px 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.back-btn:hover { background: #fff8f2; color: var(--accent-ink); }
.room-title-wrap { flex: 1 1 auto; min-width: 0; }
.room-title {
  margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.room-search-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-2);
}
.room-search-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: #ffc9b5; color: var(--accent-ink); }
.room-more { display: none; }

.search-row {
  flex: 0 0 auto;
  display: flex; gap: 6px; align-items: center;
  padding: 8px 14px;
  background: #fff; border-bottom: 1px solid var(--line-soft);
}
.search-row input {
  flex: 1 1 auto; min-width: 0;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #faf8f4;
  font-size: 13.5px; outline: none;
}
.search-row input:focus { border-color: #ffb79e; background: #fff; box-shadow: 0 0 0 3px rgba(255, 90, 43, .1); }
.search-row button {
  border: 0; background: none; color: var(--muted); font-size: 14px; padding: 6px;
}

.room-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 18px;
  scroll-behavior: smooth;
  background-image: radial-gradient(rgba(32, 40, 54, .045) 1px, transparent 1px);
  background-size: 18px 18px;
}
.day-divider { display: flex; justify-content: center; margin: 2px 0 14px; }
.day-divider span {
  font-size: 11px; font-weight: 700; color: #7c8796;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line-soft);
  padding: 3px 10px; border-radius: 999px;
}

.empty-room {
  height: 100%; min-height: 300px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; padding: 24px;
}
.empty-emoji { font-size: 42px; margin-bottom: 8px; opacity: .9; }
.empty-title { margin: 0; font-size: 15.5px; font-weight: 800; }
.empty-desc { margin: 6px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

.bubbles { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  position: relative;
  align-self: flex-start;
  max-width: 92%;
  background: var(--bubble);
  border: 1px solid #eee8de;
  border-radius: 4px 16px 16px 16px;
  padding: 12px 14px 10px;
  box-shadow: 0 1px 2px rgba(24, 39, 62, .05);
  animation: bubble-in .22s ease-out;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.bubble::before {
  content: ""; position: absolute; left: -6px; top: 0;
  border: 6px solid transparent; border-top-color: var(--bubble); border-right-color: var(--bubble);
}
.bubble.is-new { box-shadow: 0 0 0 2px rgba(255, 90, 43, .28), 0 2px 8px rgba(24, 39, 62, .06); }
.bubble-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bubble-name { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.chip {
  font-size: 10px; font-weight: 800; letter-spacing: .02em;
  color: #9a6b00; background: #fff3cf; border: 1px solid #ffe7a3;
  padding: 1px 6px; border-radius: 999px;
}
.bubble-loc { margin-top: 3px; font-size: 12px; color: #7b8494; display: flex; align-items: center; gap: 4px; }
.bubble-desc { margin: 7px 0 0; font-size: 13.5px; line-height: 1.55; color: #333d4d; white-space: pre-wrap; word-break: keep-all; }
.bubble-actions {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-soft);
}
.bubble-actions .act {
  border: 1px solid transparent; background: none; border-radius: 8px;
  padding: 4px 7px; font-size: 11.5px; font-weight: 700; color: #6b7788;
  text-decoration: none; display: inline-flex; align-items: center; gap: 3px;
}
.bubble-actions .act:hover { background: #f7f3ec; color: var(--ink); }
.bubble-actions .act.map { color: #1f7a4d; }
.bubble-actions .act.map:hover { background: #eaf7f0; }
.bubble-actions .act.del:hover { background: #fdecea; color: #c0392b; }
.bubble-time { margin-left: auto; font-size: 10.5px; color: #b3bbc7; }

/* edit mode */
.bubble.editing { background: #fffdf8; border-color: #ffd3c0; }
.edit-form { display: flex; flex-direction: column; gap: 6px; }
.edit-form input, .edit-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; font-size: 13px; outline: none;
}
.edit-form input:focus, .edit-form textarea:focus { border-color: #ffb79e; box-shadow: 0 0 0 3px rgba(255, 90, 43, .1); }
.edit-form .row { display: flex; gap: 6px; }
.edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-sm {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 6px 11px; font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.btn-sm.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm.primary:hover { background: #f04a1b; }

.no-result { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 10px; margin: 0; }

/* composer */
.composer {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px);
}
.composer-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.composer-label { font-size: 12.5px; font-weight: 800; color: var(--accent-ink); }
.composer-hint { font-size: 11px; color: var(--muted); }
.composer-rows { display: flex; flex-direction: column; gap: 6px; }
.composer-row { display: flex; gap: 6px; align-items: stretch; }
.composer-row input {
  flex: 1 1 0; min-width: 0;
  padding: 9px 11px; border-radius: 11px; border: 1px solid var(--line);
  background: #faf8f5; font-size: 13.5px; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.composer-row textarea {
  flex: 1 1 auto; min-width: 0; resize: none;
  padding: 9px 11px; border-radius: 11px; border: 1px solid var(--line);
  background: #faf8f5; font-size: 13.5px; outline: none;
  max-height: 92px; line-height: 1.4;
}
.composer-row input:focus, .composer-row textarea:focus {
  border-color: #ffb79e; background: #fff; box-shadow: 0 0 0 3px rgba(255, 90, 43, .1);
}
.composer-row input::placeholder, .composer-row textarea::placeholder { color: #a9b2c0; }
.send {
  flex: 0 0 auto; width: 44px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(255, 90, 43, .3);
  transition: background .15s, transform .15s;
}
.send:hover { background: #f04a1b; }
.send:active { transform: scale(.95); }
.send:disabled { background: #e3ded5; box-shadow: none; cursor: not-allowed; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: rgba(30, 38, 50, .94); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 90; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .layout { grid-template-columns: 1fr; }
  .map-panel { border-right: 0; border-bottom: 0; }
  .topbar { padding: 0 14px; }
  .brand h1 { font-size: 16px; }
  .brand p { font-size: 11.5px; }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; }

  .room {
    position: fixed; inset: 0; z-index: 50;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.22, .8, .3, 1);
    visibility: hidden;
    box-shadow: var(--shadow-lg);
  }
  .app.room-open .room { transform: translateY(0); visibility: visible; }
  .back-btn { display: inline-flex; align-items: center; }
  .room-head { padding: 10px 12px; gap: 8px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .room-more { display: grid; }
  .room-title { font-size: 15.5px; }
  .room-body { padding: 12px 12px 16px; }
  .bubble { max-width: 96%; }
  .composer { padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .composer-row input, .composer-row textarea { font-size: 16px; } /* iOS zoom 방지 */
  .search-row input { font-size: 16px; }

  .chips {
    display: flex; gap: 6px; overflow-x: auto;
    width: 100%; padding: 2px 2px 2px; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 11px; border-radius: 999px;
    border: 1px solid rgba(32, 40, 54, .08); background: rgba(255, 255, 255, .86);
    font-size: 12.5px; font-weight: 700; color: #3a4657;
    box-shadow: 0 1px 3px rgba(24, 39, 62, .06);
  }
  .chip-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .chip-btn .n { font-size: 10.5px; font-weight: 800; opacity: .75; }
  .map-foot { padding: 4px 12px 14px; }
}

@media (max-width: 380px) {
  .brand p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* active outline duplicate path */
.region .active-stroke { display: none; }
.region.is-active .active-stroke { display: block; }

/* map label variants */
.map-label.tiny {
  font-size: 9.5px; font-weight: 600; color: #7f8f9f;
  padding: 1px 5px; background: rgba(255, 255, 255, .66);
  border: 0; box-shadow: none; pointer-events: none;
  letter-spacing: .02em;
}
.map-label:not(.is-active).is-hover { background: #fff; }

[hidden] { display: none !important; }


/* ---------- Ulleungdo / Dokdo inset card ---------- */
.inset-card {
  position: absolute; top: 10px; right: 10px;
  width: 118px; padding: 4px 4px 0;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(32, 40, 54, .09);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(24, 39, 62, .12);
  cursor: pointer; z-index: 3;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.inset-card:hover, .inset-card.is-hover { transform: translateY(-1px); background: #fff; box-shadow: 0 10px 24px rgba(24, 39, 62, .18); }
.inset-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inset-card.is-active { box-shadow: 0 0 0 2px var(--accent), 0 10px 24px rgba(255, 90, 43, .22); }
.inset-head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  font-size: 10.5px; font-weight: 800; color: #3a4657; padding: 1px 3px 3px;
}
.inset-head .badge {
  display: inline-grid; place-items: center; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 800;
}
.inset-head .badge.zero { background: #e6eaf0; color: #93a0b1; }
.inset-card.is-active .inset-head .badge { background: #fff; color: var(--accent-ink); }
.inset-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.inset-frame { fill: #f4f9ff; stroke: #b9cde3; stroke-width: 1; stroke-dasharray: 4 3; }
.inset-land { fill: var(--land); stroke: #fff; stroke-width: 1.2; }
.inset-dokdo { fill: #fff; stroke: #4a5568; stroke-width: 1.4; }
.inset-cap { font-size: 8px; fill: #7a8b9d; text-anchor: middle; font-family: var(--font); font-weight: 700; }
.inset-note { display: block; text-align: right; font-size: 7.5px; color: #b6c2ce; padding: 1px 4px 3px; }

@media (max-width: 900px) {
  .inset-card { width: 92px; padding: 3px 3px 0; border-radius: 11px; }
  .inset-head { font-size: 8.5px; padding: 0 2px 1px; }
  .inset-head .badge { min-width: 13px; height: 13px; font-size: 8.5px; }
  .inset-cap { font-size: 7px; }
  .inset-note { display: none; }
}
