/* 留言板 v1.0.0 — 朋友圈式信息流，移动端优先 */
:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1a1c1f;
  --muted: #8a919c;
  --line: #ececef;
  --accent: #3f7ef7;
  --accent-weak: #eaf1ff;
  --danger: #e5484d;
  --pin: #f5a623;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Microsoft YaHei", "Segoe UI", sans-serif;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.ghost-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.ghost-btn:hover { color: var(--text); }
.link-btn {
  border: 0; background: none; color: var(--accent);
  font-size: 13px; cursor: pointer; padding: 0 4px;
}

/* ---- 信息流 ---- */
.feed { max-width: 640px; margin: 0 auto; padding: 12px; }
.post {
  background: var(--card); border-radius: 14px;
  padding: 14px 16px 12px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(20,30,60,.05);
}
.post-head { display: flex; gap: 10px; }
.avatar {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; user-select: none;
}
.post-meta { flex: 1; min-width: 0; }
.nick { color: var(--accent); font-weight: 600; font-size: 15px; }
.pin-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--pin); border-radius: 6px; vertical-align: 1px;
}
.post-body { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.post-foot {
  display: flex; align-items: center; gap: 16px;
  margin-top: 8px; font-size: 13px; color: var(--muted);
}
.post-foot .time { flex: 1; }
.foot-btn {
  border: 0; background: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 2px 4px;
}
.foot-btn:hover { color: var(--text); }
.foot-btn.liked { color: var(--danger); }
.foot-btn.admin-del { color: var(--danger); }
.foot-btn.admin-pin { color: var(--pin); }

/* ---- 回复区 ---- */
.replies {
  margin-top: 10px; background: var(--bg);
  border-radius: 10px; padding: 8px 12px;
}
.replies:empty { display: none; }
.reply { font-size: 14px; padding: 3px 0; word-break: break-word; }
.reply .nick { font-size: 14px; }
.reply .reply-del {
  border: 0; background: none; color: var(--danger);
  font-size: 12px; cursor: pointer; margin-left: 6px;
}
.reply-input-row { display: flex; gap: 8px; margin-top: 8px; }
.reply-input-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 14px; background: var(--card);
}
.reply-input-row button {
  border: 0; background: var(--accent-weak); color: var(--accent);
  border-radius: 8px; padding: 0 14px; font-size: 14px; cursor: pointer;
}
.reply-toggle {
  border: 0; background: none; color: var(--accent);
  font-size: 13px; cursor: pointer; padding: 0; margin-top: 6px;
}

/* ---- 底部发布栏 ---- */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  max-width: 100%;
}
.composer-nick { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.composer-nick b { color: var(--text); font-weight: 600; }
.composer-inner { max-width: 640px; margin: 0 auto; }
.composer-row { display: flex; gap: 10px; }
#bodyInput {
  flex: 1; min-width: 0; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font-size: 15px;
}
#bodyInput:focus { outline: none; border-color: var(--accent); }
.send-btn {
  border: 0; background: var(--accent); color: #fff;
  border-radius: 10px; padding: 0 20px; font-size: 15px; cursor: pointer;
}
.send-btn:disabled { opacity: .5; cursor: default; }

/* ---- 弹层 ---- */
.modal-mask {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 20px;
  width: 100%; max-width: 340px;
}
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px;
}
.modal-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.primary-btn {
  border: 0; background: var(--accent); color: #fff;
  border-radius: 10px; padding: 8px 18px; font-size: 14px; cursor: pointer;
}

/* ---- 其它 ---- */
.sentinel { height: 1px; }
.feed-end { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 0 24px; }
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(20,22,26,.88); color: #fff; font-size: 14px;
  padding: 9px 18px; border-radius: 10px; z-index: 40; max-width: 80vw;
}
.empty-tip { text-align: center; color: var(--muted); padding: 60px 0; }
