/* 好吃地图 —— 简洁优先 */
:root {
  --ink: #17171a;
  --muted: #8b8b93;
  --line: #e9e9ee;
  --bg: #fff;
  --soft: #f5f5f7;
  --wish: #f2a33c;
  --visited: #2e9e6b;
  --danger: #e5484d;
  --radius: 14px;
  --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;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

body { display: flex; flex-direction: column; }

/* --------------------------------- 顶栏 --------------------------------- */
.topbar {
  flex: none;
  position: relative;
  z-index: 500;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.topbar-row.filters {
  padding: 0 14px 10px;
  gap: 8px;
  overflow: hidden;
}
.brand {
  flex: none;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.search-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 32px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--soft);
  outline: none;
  font-size: 14px;
  -webkit-appearance: none;
}
.search-wrap input:focus { background: #fff; border-color: #cfcfd6; }
.search-wrap input::-webkit-search-cancel-button { -webkit-appearance: none; }

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.icon-btn.is-on { background: #eef7f2; border-color: #bfe4d1; }

/* 分段控件 */
.seg {
  flex: none;
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--soft);
}
.seg-wide { width: 100%; }
.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.seg-btn.is-on.is-wish { color: #a86508; }
.seg-btn.is-on.is-visited { color: #1f7a52; }

/* 筛选 chips */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 1px;
}
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  color: #55555e;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip.is-on.chip-wish { background: var(--wish); border-color: var(--wish); color: #4a2c00; }
.chip.is-on.chip-visited { background: var(--visited); border-color: var(--visited); color: #fff; }

/* --------------------------------- 主体 --------------------------------- */
#stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #eef1f4; }
.list {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 96px;
  background: #fbfbfc;
}
.hidden { display: none !important; }

/* --------------------------------- 图钉 --------------------------------- */
.pin-wrap { position: relative; }
.pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
  transition: transform .15s;
}
.pin.wish { background: var(--wish); color: #5a3600; }
.pin.visited { background: var(--visited); }
.pin.is-active { transform: scale(1.28); z-index: 5; }

/* --------------------------------- 空态 --------------------------------- */
.empty {
  position: absolute;
  left: 50%;
  bottom: calc(140px + var(--safe-b)); /* 让开定位按钮和 ＋ 按钮，也别挡住地图中心 */
  transform: translateX(-50%);
  z-index: 510; /* 必须高于 leaflet 的图层(200~700) */
  text-align: center;
  padding: 24px;
  max-width: 300px;
  background: rgba(255, 255, 255, .96);
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .1);
}
.empty-emoji { font-size: 40px; line-height: 1; }
.empty-title { margin: 10px 0 4px; font-weight: 700; font-size: 16px; }
.empty-sub { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }

/* FAB */
.fab {
  position: absolute;
  right: 16px;
  bottom: calc(20px + var(--safe-b));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  cursor: pointer;
  z-index: 1000;
  transition: transform .12s;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }

/* 选点提示 */
.pick-hint {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 1100;
  background: var(--ink);
  color: #fff;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.pick-hint .link-btn { color: #ffd08a; }

/* -------------------------------- 列表卡 -------------------------------- */
.card {
  display: flex;
  gap: 12px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 9px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: box-shadow .15s, transform .1s;
}
.card:active { transform: scale(.995); }
.card-mark {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
}
.card-mark.wish { background: var(--wish); color: #5a3600; }
.card-mark.visited { background: var(--visited); }
.card-main { min-width: 0; flex: 1; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-name {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-rates { display: flex; gap: 10px; margin-top: 5px; font-size: 12px; color: #55555e; }
.card-rates b { color: var(--ink); font-weight: 600; }

/* -------------------------------- 底部抽屉 -------------------------------- */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .16);
  padding-bottom: var(--safe-b);
  max-height: 72%;
  display: flex;
  flex-direction: column;
  animation: slideUp .22s cubic-bezier(.22, .8, .3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grab {
  flex: none;
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #dcdce2;
  margin: 9px auto 2px;
}
.sheet-body { overflow-y: auto; padding: 6px 18px 18px; }

.d-name { margin: 2px 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.d-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #55555e;
}
.badge.wish { background: #fdf1de; color: #a86508; }
.badge.visited { background: #e8f5ee; color: #1f7a52; }
.d-rates {
  display: flex;
  gap: 22px;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 12px;
  margin-bottom: 12px;
}
.d-rate-who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.d-rate-stars { font-size: 15px; letter-spacing: 1px; color: var(--wish); }
.d-rate-stars .off { color: #d5d5db; }
.d-note {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  color: #33333a;
  margin: 0 0 12px;
}
.d-row {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  color: #44444c;
}
.d-row .k { flex: none; width: 56px; color: var(--muted); }
.d-row .v { flex: 1; word-break: break-word; }
.d-row a { color: #1a6ee0; text-decoration: none; }
.d-actions { display: flex; gap: 8px; margin-top: 14px; }
.d-actions .btn-primary { flex: 1; }

/* --------------------------------- 按钮 --------------------------------- */
.btn-primary {
  border: 0;
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:active { opacity: .82; }
.btn-sm { padding: 7px 15px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-ghost:active { background: var(--soft); }
.btn-danger {
  width: 100%;
  border: 1px solid #f3c6c8;
  background: #fdf2f2;
  color: var(--danger);
  padding: 11px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-btn {
  border: 0;
  background: none;
  color: #55555e;
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
  min-width: 44px;
}

/* --------------------------------- 弹层 --------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(20, 20, 24, .38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  width: 100%;
  max-width: 560px;
  max-height: 94%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  animation: slideUp .24s cubic-bezier(.22, .8, .3, 1);
}
.modal-narrow { max-width: 420px; }
.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.modal-scroll { overflow-y: auto; padding: 16px 18px calc(24px + var(--safe-b)); -webkit-overflow-scrolling: touch; }

/* --------------------------------- 表单 --------------------------------- */
.field { margin-bottom: 15px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.req { color: var(--danger); }
.field input,
.field textarea {
  width: 100%;
  border: 1px solid #e2e2e8;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.field input:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 74px; }
.field input::placeholder, .field textarea::placeholder { color: #b4b4bd; }
.mt8 { margin-top: 8px; }
.hint { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.picker {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px dashed #d3d3da;
  border-radius: 11px;
  background: #fafafb;
  font-size: 14px;
  color: #55555e;
  cursor: pointer;
  text-align: left;
}
.picker.has-loc { border-style: solid; border-color: #bfe4d1; background: #f4fbf7; color: #1f7a52; }
.picker-go { flex: none; color: var(--muted); font-size: 13px; }
.picker.has-loc .picker-go { color: #2e9e6b; }

.poi-row { position: relative; }
.poi-list {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  max-height: 210px;
  overflow-y: auto;
}
.poi-list:empty { display: none; }
.poi-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.poi-item:last-child { border-bottom: 0; }
.poi-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.poi-empty { padding: 12px; font-size: 13px; color: var(--muted); }

/* 星级 */
.rate-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.rate-who { flex: none; width: 52px; font-size: 13.5px; color: #55555e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { display: flex; gap: 2px; }
.star {
  border: 0;
  background: none;
  padding: 2px 3px;
  font-size: 23px;
  line-height: 1;
  color: #dcdce2;
  cursor: pointer;
  transition: transform .1s;
}
.star.on { color: var(--wish); }
.star:active { transform: scale(1.18); }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 1600;
  background: rgba(23, 23, 26, .92);
  color: #fff;
  padding: 5px 14px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 84%;
  text-align: center;
  animation: fadeIn .16s ease;
  pointer-events: none;
  line-height: 1.45;
}

/* 身份选择 */
.who-row { display: flex; gap: 10px; }
.who-btn {
  flex: 1;
  padding: 18px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.who-btn:active { background: var(--soft); }

/* 定位按钮 */
.map-btn {
  position: absolute;
  right: 16px;
  bottom: calc(86px + var(--safe-b));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
  cursor: pointer;
  z-index: 1000;
  transition: transform .12s;
}
.map-btn:active { transform: scale(.92); }
.map-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.map-btn.is-locating svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 我的位置蓝点 */
.me-wrap { pointer-events: none; }
.me-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2f7cf6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(47, 124, 246, .22), 0 2px 6px rgba(0, 0, 0, .3);
}

.use-me {
  display: block;
  margin-top: 9px;
  font-size: 13px;
  color: #1a6ee0;
  padding: 2px 0;
}

/* 详情卡关闭 */
.sheet-close {
  position: absolute;
  top: -2px;
  right: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.list-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 40px 0;
}

/* Leaflet 微调 */
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, .8) !important;
}
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 2px 10px rgba(0, 0, 0, .14) !important; }
.leaflet-control-zoom a {
  border-radius: 9px !important;
  color: #33333a !important;
  border: 0 !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
}
.leaflet-container { font-family: inherit; }
.leaflet-fade-anim .leaflet-popup { display: none; }
.pickable { cursor: crosshair !important; }

@media (min-width: 720px) {
  .modal { align-items: center; }
  .modal-panel { border-radius: 18px; max-height: 88%; }
  .sheet { left: auto; right: 20px; bottom: 20px; width: 400px; border-radius: 18px; max-height: 74%; }
  .sheet-grab { display: none; }
  .list { padding: 16px 24px 96px; }
}
