/* ============================================================
   成都吃货地图 · 移动端样式
   设计语言借鉴自开源项目(eat-what / WSIGTE / findfood / weui):
   暖纸米白底 + 火锅橘红品牌色 + 好吃绿/不好吃红语义色;
   「实体键下压」大按钮 / 聚焦光圈搜框 / 底部滑入弹层 / 圆角卡片流
   ============================================================ */

:root {
  --bg: #faf6ef;                /* 页面底(暖纸米白) */
  --surface: #ffffff;           /* 卡片 / 弹层 */
  --surface-2: #f4ede1;         /* 次级灰底(搜索框内底/标签底) */
  --line: rgba(122, 110, 88, .16);
  --ink: #26211a;               /* 主文字(暖黑) */
  --ink-2: #857b69;             /* 次级文字 */
  --ink-3: #b1a894;             /* 弱提示 */

  --brand: #ed5c2b;             /* 火锅橘红 */
  --brand-deep: #d84612;
  --brand-soft: rgba(237, 92, 43, .12);

  --good: #1e9e61;              /* 好吃 = 绿 */
  --good-bg: #e0f3e8;
  --good-deep: #0f7a46;
  --bad: #dc4444;               /* 不好吃 = 红 */
  --bad-bg: #fbe8e4;
  --bad-deep: #b52f2f;

  --shadow-soft: 0 2px 14px rgba(58, 45, 26, .08);
  --shadow-pop: 0 10px 34px rgba(58, 45, 26, .18);
  --r-sm: 10px;
  --r-md: 16px;
  --r-full: 999px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; }
input, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0;
  height: calc(52px + var(--safe-t));
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: var(--safe-t) 14px 0;
  background: rgba(250, 246, 239, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 0 var(--line);
}
.brand {
  display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 18px; letter-spacing: .3px; white-space: nowrap;
}
.brandMark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: linear-gradient(160deg, #f6a560, var(--brand) 60%, var(--brand-deep));
  box-shadow: 0 3px 8px rgba(237, 92, 43, .32), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand .name span { color: var(--brand); }

/* 顶栏右侧按钮组 + 管理员齿轮 */
.topRight { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.gear {
  width: 34px; height: 34px; border: 0; background: transparent;
  font-size: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: .5; transition: opacity .2s ease, background .2s ease, transform .1s ease;
}
.gear:active { transform: scale(.9); }
.gear.admin { opacity: 1; background: var(--brand-soft); }
@media (max-width: 360px) {
  .brand .name { font-size: 16px; }
  .gear { width: 30px; height: 30px; }
}

/* 地图/列表 滑动胶囊切换 */
.seg {
  position: relative;
  display: flex; background: #efe8db; border-radius: var(--r-full);
  padding: 3px; box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.seg button {
  position: relative; z-index: 1;
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; padding: 7px 16px; border-radius: var(--r-full);
  transition: color .22s ease;
}
.seg button.on {
  color: var(--brand-deep);
  background: #fff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(58, 45, 26, .14);
}

/* ===== 视图容器 ===== */
.view { position: fixed; top: calc(52px + var(--safe-t)); left: 0; right: 0; bottom: 0; }
#viewMap { overflow: hidden; }
#map { position: absolute; inset: 0; }

/* 未配置 key 提示 */
.banner {
  position: absolute; z-index: 20; top: 12px; left: 12px; right: 12px;
  background: #fff4e3; border: 1px solid #f3c78b; color: #a0501a;
  border-radius: 14px; padding: 13px 15px; font-size: 13px; line-height: 1.6;
  text-align: center; box-shadow: var(--shadow-soft);
}
.banner code { background: #ffe9c8; padding: 1px 5px; border-radius: 5px; }

/* ===== 搜索(聚焦光圈胶囊,借鉴 findfood) ===== */
.searchWrap {
  position: absolute; z-index: 20; top: 12px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}
.searchWrap > * { pointer-events: auto; }
.searchBox {
  width: calc(100% - 24px); max-width: 560px;
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-full);
  box-shadow: var(--shadow-soft);
  padding: 0 15px; height: 46px;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.searchBox:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-soft);
}
.searchIcon {
  width: 18px; height: 18px; flex: 0 0 auto; opacity: .75;
  background: currentColor; color: var(--ink-2);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7" fill="none" stroke="black" stroke-width="2.4"/><line x1="16.5" y1="16.5" x2="21" y2="21" stroke="black" stroke-width="2.4" stroke-linecap="round"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7" fill="none" stroke="black" stroke-width="2.4"/><line x1="16.5" y1="16.5" x2="21" y2="21" stroke="black" stroke-width="2.4" stroke-linecap="round"/></svg>') center / contain no-repeat;
}
#search {
  flex: 1; min-width: 0; border: 0; outline: 0;
  font-size: 16px; color: var(--ink); background: transparent; padding: 0;
}
#search::placeholder { color: var(--ink-3); }

.ac {
  margin-top: 8px; width: calc(100% - 24px); max-width: 560px;
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-pop); border: 1px solid var(--line);
}
.acItem {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.acItem:last-child { border-bottom: 0; }
.acItem:active { background: var(--surface-2); }
.acItem .nm { font-weight: 600; }
.acItem .ad { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acItem .tag { font-size: 11px; color: var(--brand); }

/* 悬浮统计胶囊 / 地图页提示 */
.chip, .hint {
  position: absolute; z-index: 20; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.95); border: 1px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-soft);
  padding: 7px 14px; font-size: 13px; backdrop-filter: blur(8px);
}
.chip { top: 68px; font-weight: 600; }
.hint { bottom: calc(18px + var(--safe-b)); font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.chip b.good { color: var(--good); } .chip b.bad { color: var(--bad); }
.chip .sep { opacity: .4; margin: 0 3px; }

/* ===== 地图 pin(自定义 DOM 内容) ===== */
/* marker 定位由 AMap offset 实现,内容元素不要再设 transform */
.pin {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.32), 0 0 0 1px rgba(0,0,0,.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pin:active { transform: scale(1.12); }
.pin-good {
  background: linear-gradient(180deg, #35b57c, var(--good));
}
.pin-bad {
  background: linear-gradient(180deg, #f06a6a, var(--bad));
}
/* 选中待标注的蓝点(带呼吸光圈) */
.locateSpot {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand);
  box-shadow: 0 0 0 7px rgba(237, 92, 43, .3);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 7px rgba(237, 92, 43, .32); }
  50%      { box-shadow: 0 0 0 12px rgba(237, 92, 43, .14); }
}

/* 评价色(列表项与详情共用) */
.rt.good { color: var(--good); }
.rt.bad { color: var(--bad); }

/* ===== 列表视图 ===== */
#viewList { display: flex; flex-direction: column; background: var(--bg); }
.filters {
  display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; column-gap: 8px;
  padding: 12px 14px; background: var(--bg);
  border-bottom: 1px solid var(--line);
  width: 100%; max-width: 720px; margin: 0 auto;
}
.chipBtn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: var(--r-full);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: transform .12s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.chipBtn:active { transform: scale(.95); }
.chipBtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chipBtn.good.on { background: var(--good); border-color: var(--good); }
.chipBtn.bad.on { background: var(--bad); border-color: var(--bad); }
.chipBtn[data-f="mine"].on { background: #7c3aed; border-color: #7c3aed; }
.listCount { margin-left: auto; font-size: 12px; color: var(--ink-2); font-weight: 500; }

/* 帮我挑:实体键下压(借鉴 eat-what) */
.rollBtn {
  border: 0;
  background: linear-gradient(180deg, #ff8a3d, var(--brand) 55%, var(--brand-deep));
  color: #fff; border-radius: var(--r-full);
  font-size: 13px; font-weight: 800; padding: 8px 14px; letter-spacing: .3px;
  box-shadow: 0 5px 0 #b23a0c, 0 7px 14px rgba(237, 92, 43, .3);
  transition: transform .1s ease, box-shadow .1s ease;
}
.rollBtn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b23a0c, 0 4px 10px rgba(237, 92, 43, .25);
}

/* 列表内容(圆角卡片流) */
.listWrap { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.list {
  list-style: none; margin: 0 auto; padding: 10px 14px calc(22px + var(--safe-b));
  width: 100%; max-width: 720px;
}
.item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(58, 45, 26, .04);
  transition: transform .12s ease, box-shadow .18s ease;
}
.item:active { transform: scale(.985); box-shadow: none; }
.item .face {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.face.good { background: var(--good-bg); }
.face.bad { background: var(--bad-bg); }
.item .body { flex: 1; min-width: 0; }
.item .nmRow { display: flex; align-items: flex-start; gap: 6px; }
.item .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; word-break: break-all; }
.item .rt {
  font-size: 11px; font-weight: 700; flex: 0 0 auto; margin-top: 1px;
  padding: 2.5px 9px; border-radius: var(--r-full);
}
.item .rt.good { color: var(--good-deep); background: var(--good-bg); }
.item .rt.bad { color: var(--bad-deep); background: var(--bad-bg); }
.item .ad {
  font-size: 12px; color: var(--ink-2); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.item .ad::before { content: "📍"; font-size: 10px; opacity: .8; }
.item .note {
  font-size: 13px; color: #4c443a; margin-top: 6px; word-break: break-all;
  background: var(--surface-2); border-radius: 8px; padding: 7px 9px; line-height: 1.5;
}
.item .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; }
.empty {
  text-align: center; color: var(--ink-2); padding: 70px 24px;
  font-size: 14.5px; line-height: 2;
}
.empty .big {
  width: 64px; height: 64px; border-radius: 22px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  background: var(--surface-2);
}

/* ===== 底部弹层(mask 淡入 + 面板上滑,借鉴 weui actionsheet) ===== */
.mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(33, 24, 12, .42);
  animation: fadeIn .22s ease;
}
.sheet {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(58, 45, 26, .22);
  max-height: 86dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 18px calc(20px + var(--safe-b));
  animation: sheetUp .3s cubic-bezier(.32, .72, 0, 1);
}
.sheet > .grab { width: 42px; height: 5px; border-radius: 99px; background: #ddd3c0; margin: 9px auto 12px; }
.sheet h3 { margin: 2px 0 3px; font-size: 17.5px; line-height: 1.35; word-break: break-all; }
.sheet .poiAddr {
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px;
  line-height: 1.5; word-break: break-all;
}

.field { margin: 13px 0; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-size: 15px; color: var(--ink); outline: none;
  background: var(--surface-2); resize: none; transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input:focus, .field textarea:focus {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* 好吃/不好吃:两个实体键下压大按钮 */
.ratingRow { display: flex; gap: 12px; }
.ratingBtn {
  flex: 1; border: 0; background: #fff; color: var(--ink);
  border-radius: 16px; padding: 15px 8px; font-size: 15px; font-weight: 800;
  display: flex; flex-direction: column; gap: 5px; align-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line), 0 5px 0 #ece3d2;
  transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
}
.ratingBtn .face { font-size: 27px; }
.ratingBtn:active { transform: translateY(4px); box-shadow: inset 0 0 0 1.5px var(--line), 0 1px 0 #ece3d2; }
.ratingBtn.on-good {
  background: var(--good-bg); color: var(--good-deep);
  box-shadow: inset 0 0 0 1.5px var(--good), 0 5px 0 #b9dfca;
}
.ratingBtn.on-good:active { box-shadow: inset 0 0 0 1.5px var(--good), 0 1px 0 #b9dfca; }
.ratingBtn.on-bad {
  background: var(--bad-bg); color: var(--bad-deep);
  box-shadow: inset 0 0 0 1.5px var(--bad), 0 5px 0 #e7c2ba;
}
.ratingBtn.on-bad:active { box-shadow: inset 0 0 0 1.5px var(--bad), 0 1px 0 #e7c2ba; }

.btnRow { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  border: 0; border-radius: var(--r-full); font-size: 15px; font-weight: 700;
  padding: 13px 18px; flex: 1;
}
.btn-ghost {
  background: #f0e9dc; color: var(--ink-2);
  box-shadow: 0 4px 0 #ddd2bd;
}
.btn-ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 #ddd2bd; }
.btn-primary {
  background: linear-gradient(180deg, #f26a31, var(--brand) 55%, var(--brand-deep));
  color: #fff;
  box-shadow: 0 5px 0 #a93609, 0 8px 16px rgba(237, 92, 43, .3);
  transition: transform .1s ease, box-shadow .1s ease, filter .2s ease;
}
.btn-primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #a93609; }
.btn-primary:disabled { background: #eecfbd; color: #fff; box-shadow: none; filter: saturate(.6); }
.btn-danger {
  background: linear-gradient(180deg, #ee6a6a, var(--bad));
  color: #fff;
  box-shadow: 0 5px 0 #992727, 0 8px 16px rgba(220, 68, 68, .25);
}
.btn-danger:active { transform: translateY(4px); box-shadow: 0 1px 0 #992727; }
.btn[hidden] { display: none; }

/* 防重复提醒(借鉴 foodmap) */
.warnNote {
  background: #fff6df; border: 1px solid #f2d488; color: #8a5a12;
  font-size: 12.5px; line-height: 1.65; border-radius: 11px; padding: 9px 12px;
  margin: 4px 0 13px;
}

/* 详情头部 */
.detailHead { display: flex; align-items: center; gap: 12px; }
.detailHead .face {
  width: 50px; height: 50px; border-radius: 15px; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.detailHead .face.good { background: var(--good-bg); }
.detailHead .face.bad { background: var(--bad-bg); }
.detailRows { margin: 13px 0; background: var(--surface-2); border-radius: 14px; padding: 2px 14px; }
.detailRow {
  display: flex; gap: 10px; font-size: 14px; padding: 10px 0;
  border-bottom: 1px dashed rgba(122, 110, 88, .18);
}
.detailRow:last-child { border-bottom: 0; }
.detailRow .k { color: var(--ink-2); flex: 0 0 52px; font-weight: 600; }
.detailRow .v { flex: 1; word-break: break-all; line-height: 1.5; }

/* ===== toast ===== */
.toast {
  position: fixed; z-index: 90; left: 50%;
  bottom: calc(16% + var(--safe-b));
  transform: translateX(-50%) translateY(10px);
  background: rgba(38, 33, 26, .92); color: #fff; border-radius: var(--r-full);
  padding: 11px 18px; font-size: 14px; font-weight: 500; opacity: 0;
  pointer-events: none; max-width: 84vw; text-align: center;
  transition: opacity .2s, transform .25s cubic-bezier(.19, 1, .22, 1);
  box-shadow: var(--shadow-pop); backdrop-filter: blur(6px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes sheetUp { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

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