/* ============ Rind · 地图社交 · 高级简约 (iOS native) ============ */
:root {
  --coral: #FF6B6B;            /* 点睛色：仅发布按钮 / 选中态 / 点赞激活 */
  --bg: #F7F7F8;              /* 页面底 (iOS grouped) */
  --card: #FFFFFF;
  --ink: #1C1C1E;             /* 主文字 */
  --ink-2: #8E8E93;           /* 次文字 */
  --ink-3: #C7C7CC;           /* 三级文字 */
  --hairline: #E5E5EA;        /* 1px 分隔线 */
  --fill: #F2F2F4;            /* 浅灰填充 */
  --radius: 12px;
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, .06);
  --tabbar-h: 64px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
main { flex: 1; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); }
.view.active { display: flex; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); font-size: 13px; }

/* ---------- 页面头 ---------- */
.page-head { padding: 20px 18px 10px; }
.page-head h1 { font-size: 20px; font-weight: 600; letter-spacing: 0; }

/* ---------- 底部导航 (iOS tab bar) ---------- */
#tabbar {
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .88);
  border-top: 1px solid var(--hairline);
  display: flex;
  z-index: 500;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-2); font-size: 10px; font-weight: 500; height: var(--tabbar-h);
}
.tab.active { color: var(--ink); font-weight: 600; }
.tab-ico { line-height: 0; }
.tab-ico svg { width: 25px; height: 25px; display: block; }
.tab-publish { position: relative; }
.tab-publish-plus {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--coral);
  color: #fff; font-size: 28px; font-weight: 300; line-height: 50px; text-align: center;
  margin-top: -24px; box-shadow: 0 4px 12px rgba(255, 107, 107, .35);
}

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--coral);
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-ghost {
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--hairline);
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer;
}
.btn-danger {
  padding: 11px 18px; border-radius: 10px; border: none;
  background: var(--coral); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
/* 中性操作按钮（原 teal）：深色胶囊 / 描边款 */
.btn-teal {
  padding: 9px 18px; border-radius: 999px; border: none;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-teal.outline { background: #fff; color: var(--ink); border: 1px solid var(--hairline); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--hairline); cursor: pointer;
  background: #fff; box-shadow: var(--shadow-soft); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 表单 ---------- */
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink-3); }
textarea { resize: vertical; min-height: 110px; }
.form-msg { min-height: 20px; font-size: 13px; color: var(--coral); margin-top: 8px; text-align: center; }
.form-msg.ok { color: var(--ink-2); }

/* ---------- 弹窗 (底部浮层) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .4);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: #fff; width: 100%; max-width: 520px;
  max-height: 92dvh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  position: relative; animation: slideUp .25s ease;
}
.modal-small h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.modal-card input { margin-bottom: 10px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--fill); font-size: 14px; cursor: pointer; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.row-btns { display: flex; gap: 10px; margin-top: 16px; }
.row-btns .btn-ghost, .row-btns .btn-danger { flex: 1; }

/* ---------- 底部动作菜单 (iOS action sheet) ---------- */
#avatar-sheet .modal-card { background: transparent; box-shadow: none; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.sheet-opt {
  display: block; width: 100%; padding: 15px; margin-bottom: 8px;
  border: none; border-radius: 14px; background: rgba(255, 255, 255, .97);
  font-size: 16px; font-weight: 500; cursor: pointer; color: var(--ink);
}
.sheet-opt:active { background: var(--fill); }
.sheet-cancel { font-weight: 600; color: var(--ink); margin-bottom: 0; }
#avatar-sheet h3 { color: #fff; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: rgba(28, 28, 30, .92); color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 20px; border-radius: 12px; z-index: 2000;
  max-width: 86vw; text-align: center; animation: fadeIn .2s ease;
  pointer-events: none;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; } }

/* ---------- 分段选择 (iOS segmented) ---------- */
.seg-tabs {
  display: flex; padding: 2px; margin: 4px 18px 10px;
  background: #E9E9EE; border-radius: 10px; flex-shrink: 0;
}
.seg-tabs .seg {
  flex: 1; padding: 8px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--ink); font-size: 13.5px; font-weight: 400;
}
.seg-tabs .seg.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.modal-card .seg-tabs { margin: 0 0 14px; }

/* ---------- 分类 chips ---------- */
.chips { display: flex; gap: 8px; padding: 2px 18px 12px; overflow-x: auto; flex-shrink: 0; }
.chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--hairline);
  background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* ---------- 动态卡片 ---------- */
.feed-list { padding: 2px 14px calc(var(--tabbar-h) + 20px); display: flex; flex-direction: column; gap: 10px; }
.post-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--hairline);
  padding: 14px 16px; cursor: pointer;
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: #E9E9EE; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; color: var(--ink-2); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-meta { flex: 1; min-width: 0; }
.post-author { font-weight: 600; font-size: 14.5px; }
.post-time { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.cat-tag {
  font-size: 11.5px; font-weight: 500; background: var(--fill); color: var(--ink-2);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.post-content {
  font-size: 15px; margin: 4px 0 10px; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.post-img { width: 100%; border-radius: 8px; margin-bottom: 10px; display: block; max-height: 320px; object-fit: cover; background: var(--fill); }
.post-actions { display: flex; border-top: 1px solid var(--hairline); padding-top: 4px; margin-top: 2px; }
.act-btn {
  flex: 1; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 9px 4px; border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.act-btn:active { background: var(--fill); }
.act-btn .ic { width: 19px; height: 19px; display: block; }
.act-btn.on { color: var(--coral); font-weight: 600; }
.act-btn.on .ic { fill: var(--coral); stroke: var(--coral); }
.act-btn.fav-on { color: var(--ink); font-weight: 600; }
.act-btn.fav-on .ic { fill: var(--ink); stroke: var(--ink); }

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); font-size: 14px; }
.empty .big { font-size: 38px; margin-bottom: 10px; opacity: .9; }
.loading { text-align: center; padding: 30px; color: var(--ink-2); font-size: 14px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 8px; border-radius: 50%;
  border: 2.5px solid var(--hairline); border-top-color: var(--ink-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 地图页 ---------- */
#view-map { overflow: hidden; background: transparent; }
#map { position: absolute; inset: 0; z-index: 1; }
.map-topbar {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 500;
  display: flex; gap: 10px;
}
.map-topbar select {
  width: auto; flex: 1; border: 1px solid var(--hairline); font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow-soft); border-radius: 999px; padding: 10px 14px;
}
.map-topbar .icon-btn { border: 1px solid var(--hairline); }
.fab {
  position: absolute; z-index: 500; right: 16px; bottom: calc(var(--tabbar-h) + 88px);
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--coral); color: #fff;
  font-size: 30px; font-weight: 300; line-height: 1; box-shadow: 0 4px 14px rgba(255, 107, 107, .35);
  display: flex; align-items: center; justify-content: center;
}
.map-card {
  position: absolute; z-index: 600; left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + 14px);
  background: #fff; border-radius: var(--radius); border: 1px solid var(--hairline);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  padding: 12px 14px; cursor: pointer; animation: slideUp .22s ease;
  display: flex; gap: 12px; align-items: center;
}
.map-card img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--fill); }
.map-card .mc-body { flex: 1; min-width: 0; }
.map-card .mc-text { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.map-card .mc-meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.map-card .mc-meta .ic { width: 13px; height: 13px; }

/* 头像图钉：白色圆形 + 细描边 + 淡阴影 */
.map-pin.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #E9E9EE;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .08);
  display: flex; align-items: center; justify-content: center;
  overflow: visible;
  position: relative;
  transition: transform .2s ease, border-color .2s ease;
}
.map-pin.avatar.selected { transform: scale(1.22); border-color: var(--coral); }
.map-pin.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.map-pin.avatar.me { border-color: var(--ink); }
.map-pin.avatar .pin-initial { color: var(--ink-2); font-weight: 600; font-size: 16px; }
.map-pin.avatar .pin-cat {
  position: absolute; right: -4px; bottom: -4px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; border: .5px solid var(--hairline);
  font-size: 10px; line-height: 16px; text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* 聚合气泡：极简 */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background: rgba(255, 255, 255, .92) !important;
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}
.marker-cluster div {
  background: var(--ink) !important; color: #fff !important;
  font: 600 12px -apple-system, sans-serif !important;
}
.marker-cluster span { line-height: 30px !important; }

/* ---------- 发布页 ---------- */
.publish-body { padding: 4px 18px calc(var(--tabbar-h) + 24px); display: flex; flex-direction: column; gap: 14px; }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-thumb { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; position: relative; background: var(--fill); }
.photo-add {
  width: 84px; height: 84px; border-radius: 8px; border: 1.5px dashed var(--ink-3);
  background: #fff; color: var(--ink-3); font-size: 26px; font-weight: 300; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-wrap { position: relative; }
.photo-del {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(28, 28, 30, .85); color: #fff; border: none; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#publish-map { height: 220px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--hairline); z-index: 1; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: -8px; }

/* ---------- 详情 ---------- */
.detail-imgs { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.detail-imgs img { width: 100%; border-radius: 10px; display: block; background: var(--fill); }
.detail-content { font-size: 16px; white-space: pre-wrap; word-break: break-word; margin: 8px 0; }
.detail-actions { display: flex; gap: 6px; margin: 12px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 4px 0; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.comment .avatar { width: 32px; height: 32px; font-size: 13px; }
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-text { font-size: 14px; word-break: break-word; margin-top: 2px; }
.comment-input-row { display: flex; gap: 8px; margin-top: 12px; position: sticky; bottom: 0; background: #fff; padding: 10px 0; border-top: 1px solid var(--hairline); }
.comment-input-row input { flex: 1; border-radius: 999px; }
.comment-input-row button { flex-shrink: 0; width: auto; padding: 12px 22px; border-radius: 999px; }
.author-row { display: flex; align-items: center; gap: 10px; }
.author-row .post-meta { flex: 1; }

/* ---------- 社交 ---------- */
.user-row {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--hairline);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
}
.user-row .post-meta { flex: 1; }
.follow-btn {
  padding: 7px 18px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.follow-btn.following { background: var(--fill); color: var(--ink-2); font-weight: 500; }
#social-body { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 我的 (iOS 设置式) ---------- */
.profile-top { padding: 26px 18px 14px; display: flex; gap: 14px; align-items: center; background: #fff; border-bottom: 1px solid var(--hairline); }
.profile-top .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile-name { font-size: 19px; font-weight: 600; }
.profile-bio { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.profile-stats { display: flex; background: #fff; border-bottom: 1px solid var(--hairline); padding: 10px 18px 14px; }
.stat { flex: 1; text-align: center; }
.stat b { display: block; font-size: 17px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--ink-2); }
.profile-actions { padding: 14px 18px 4px; display: flex; flex-direction: column; gap: 0; }
.profile-actions .row-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--hairline); cursor: pointer;
  padding: 13px 16px; font-size: 15px; font-weight: 500; color: var(--ink); text-align: left;
}
.profile-actions .row-item:first-child { border-radius: 12px 12px 0 0; border-bottom: none; }
.profile-actions .row-item:last-child { border-radius: 0 0 12px 12px; color: var(--ink-2); }
.profile-actions .row-item .chev { color: var(--ink-3); font-size: 18px; }
.my-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 18px calc(var(--tabbar-h) + 20px); }
.my-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; background: var(--fill); }
.my-grid .noimg {
  aspect-ratio: 1; border-radius: 8px; background: var(--fill); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-2);
  padding: 8px; text-align: center; overflow: hidden;
}
.login-hint { padding: 60px 30px; text-align: center; color: var(--ink-2); font-size: 14px; }
.login-hint .big { font-size: 44px; margin-bottom: 12px; opacity: .9; }
.login-hint .btn-primary { max-width: 220px; margin: 16px auto 0; }

.leaflet-container { font-family: inherit; background: #E9E9EB; }
