*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 100px;
  -webkit-tap-highlight-color: transparent;
}

/* 顶部 */
header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #4A90D9, #5BA0E8);
  color: #fff; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; box-shadow: 0 2px 12px rgba(74,144,217,0.25);
}
.header-title { font-size: 18px; font-weight: 600; }
.header-user { font-size: 13px; opacity: 0.9; cursor: pointer; }

/* 面板切换 */
.panel { display: none; }
.panel.active { display: block; }

/* ===== 底部导航 ===== */
#bottomNav {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 600px; margin: 0 auto;
  display: flex; background: #fff; border-top: 1px solid #eee;
  padding-bottom: env(safe-area-inset-bottom); z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 4px; cursor: pointer; color: #999; transition: color 0.2s;
}
.nav-item.active { color: #4A90D9; }
.nav-icon { font-size: 22px; }
.nav-text { font-size: 11px; margin-top: 2px; }

/* 帖子列表 */
#postList { padding: 12px; }
.tip { text-align: center; padding: 40px; color: #999; font-size: 14px; }

.post-card {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04); animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.post-header { display: flex; align-items: center; margin-bottom: 12px; }
.post-avatar {
  width: 42px; height: 42px; border-radius: 50%; margin-right: 10px;
  background: #e8edf2; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #4A90D9;
}
.post-nickname { font-size: 15px; font-weight: 500; color: #333; }
.post-time { font-size: 12px; color: #999; margin-left: auto; }
.post-body { font-size: 15px; line-height: 1.6; margin-bottom: 12px; word-break: break-word; }

/* 帖子图片 */
.post-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.post-images img {
  width: calc(33.33% - 6px); aspect-ratio: 1; object-fit: contain;
  border-radius: 8px; background: #f0f0f0; cursor: pointer;
}
.post-actions { display: flex; align-items: center; border-top: 1px solid #f0f0f0; padding-top: 12px; gap: 28px; }
.post-actions .act {
  display: flex; align-items: center; gap: 5px; font-size: 13px; color: #999; cursor: pointer;
  user-select: none; transition: color 0.15s;
}
.post-actions .act:active { opacity: 0.6; }
.post-actions .act.liked { color: #FF6B6B; }
.act-icon { font-size: 16px; }

/* ===== 发帖面板 ===== */
.post-page { padding: 16px; }
#postContent {
  width: 100%; min-height: 200px; border: 1.5px solid #e8e8e8;
  border-radius: 12px; padding: 14px; font-size: 15px; resize: none;
  outline: none; font-family: inherit; line-height: 1.6; background: #fff;
}
#postContent:focus { border-color: #4A90D9; }
.char-count { text-align: right; font-size: 12px; color: #bbb; margin: 4px 0; }

.image-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.image-grid .img-item {
  position: relative; width: calc(33.33% - 6px); aspect-ratio: 1;
}
.image-grid .img-item img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.image-grid .img-item .del-img {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px;
  background: rgba(0,0,0,0.55); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  cursor: pointer; line-height: 1;
}

.toolbar { display: flex; gap: 12px; align-items: center; margin: 12px 0 16px; }
.tool-btn, .anon-label {
  padding: 8px 16px; border: 1px solid #ddd; border-radius: 20px;
  font-size: 13px; cursor: pointer; background: #fff; color: #666;
  display: flex; align-items: center; gap: 4px;
}
.tool-btn:active, .anon-label:active { background: #f5f5f5; }
.anon-label input { width: 16px; height: 16px; accent-color: #4A90D9; margin: 0; }

/* ===== 我的面板 ===== */
.mine-page { padding-bottom: 20px; }
.user-card {
  display: flex; flex-direction: column; align-items: center; padding: 40px 0 24px;
  background: linear-gradient(135deg, #4A90D9, #7BB3E8); color: #fff;
}
.user-avatar { font-size: 48px; margin-bottom: 8px; }
.user-name { font-size: 20px; font-weight: 500; margin-bottom: 12px; }
.btn-outline {
  background: transparent; border: 1px solid rgba(255,255,255,0.6); color: #fff;
  font-size: 13px; padding: 6px 18px; border-radius: 16px; cursor: pointer;
}

.mine-tabs { display: flex; background: #fff; border-bottom: 1px solid #eee; }
.mine-tab {
  flex: 1; text-align: center; padding: 14px 0; font-size: 14px;
  color: #999; cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.mine-tab.active { color: #4A90D9; border-bottom-color: #4A90D9; }

.mine-content { padding: 12px; }
.mine-content .post-card { padding: 14px; }
.mine-content .post-body {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 14px;
}

.btn-logout {
  background: #fff; border: 1px solid #FF6B6B; color: #FF6B6B;
  margin: 20px 16px; padding: 12px; border-radius: 10px; font-size: 15px;
  cursor: pointer; width: calc(100% - 32px);
}

/* ===== 评论弹窗 ===== */
.modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45); justify-content: center; align-items: flex-end;
}
.modal.active { display: flex; }
.modal-content {
  background: #fff; border-radius: 20px 20px 0 0;
  width: 100%; max-width: 600px; max-height: 85vh;
  overflow-y: auto; padding: 24px 20px;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { font-size: 28px; color: #999; cursor: pointer; line-height: 1; padding: 0 4px; }

.comment-box { max-height: 80vh; display: flex; flex-direction: column; }
#commentList { flex: 1; overflow-y: auto; margin-bottom: 12px; }
.comment-item { padding: 12px 0; border-bottom: 1px solid #f5f5f5; }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #e8edf2;
  float: left; margin-right: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 14px; color: #4A90D9;
}
.comment-body { margin-left: 44px; }
.comment-nickname { font-size: 13px; font-weight: 500; color: #4A90D9; margin-bottom: 3px; }
.comment-text { font-size: 14px; color: #333; line-height: 1.5; word-break: break-word; }
.comment-time { font-size: 11px; color: #bbb; margin-top: 2px; }
.comment-reply-btn {
  font-size: 11px; color: #999; cursor: pointer; margin-left: 10px;
}
/* 子回复缩进 */
.comment-item.child { margin-left: 32px; border-left: 2px solid #e8edf2; padding-left: 12px; border-bottom: none; padding-bottom: 8px; margin-top: 4px; }

.comment-input-row { display: flex; flex-direction: column; gap: 8px; }
.reply-hint {
  font-size: 12px; color: #4A90D9; padding: 4px 10px; background: #eef4fb;
  border-radius: 12px; display: flex; align-items: center; justify-content: space-between;
}
.reply-hint .cancel-reply { color: #999; cursor: pointer; font-size: 14px; margin-left: 8px; }
.comment-input-row .input-wrap { display: flex; gap: 10px; }
.comment-input-row input {
  flex: 1; padding: 10px 14px; border: 1.5px solid #e8e8e8;
  border-radius: 22px; font-size: 14px; outline: none;
}
.comment-input-row input:focus { border-color: #4A90D9; }

/* ===== 登录弹窗 ===== */
.login-box { text-align: center; padding-top: 40px; border-radius: 24px !important; padding-bottom: 32px !important; }
.login-icon { font-size: 56px; margin-bottom: 16px; }
.login-box h2 { font-size: 22px; margin-bottom: 8px; }
.login-sub { color: #999; font-size: 13px; margin-bottom: 28px; }
.form-group { text-align: left; margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-group input, .form-group input[type="password"] {
  width: 100%; padding: 12px 14px; border: 1.5px solid #e0e0e0;
  border-radius: 10px; font-size: 15px; outline: none;
}
.form-group input:focus, .form-group input[type="password"]:focus { border-color: #4A90D9; }
.switch-mode { margin-top: 16px; font-size: 13px; color: #999; text-align: center; }
.switch-mode a { color: #4A90D9; text-decoration: none; margin-left: 4px; }

/* 编辑资料弹窗 */
.profile-box { padding-bottom: 28px; }

/* 按钮 */
.btn {
  border: none; border-radius: 10px; cursor: pointer; font-size: 15px;
  transition: background 0.2s, opacity 0.2s;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: #4A90D9; color: #fff; }
.btn-block { width: 100%; padding: 14px; font-size: 16px; font-weight: 500; }
.btn-small { padding: 8px 18px; font-size: 13px; border-radius: 18px; flex-shrink: 0; }

/* Toast */
#toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
  background: rgba(0,0,0,0.78); color: #fff; padding: 12px 24px;
  border-radius: 10px; font-size: 14px; z-index: 999;
  pointer-events: none; transition: transform 0.2s ease;
}
#toast.show { transform: translate(-50%,-50%) scale(1); }
/* ===== 管理员 ===== */
.btn-admin {
  background: #fff; border: 1px solid #4A90D9; color: #4A90D9;
  margin: 0 16px 12px; padding: 12px; border-radius: 10px;
  font-size: 15px; cursor: pointer; width: calc(100% - 32px);
}
.admin-box { max-height: 80vh; padding-bottom: 20px; }
.admin-tabs { display: flex; border-bottom: 1px solid #eee; margin-bottom: 16px; }
.admin-tab {
  padding: 10px 20px; font-size: 14px; color: #999; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.admin-tab.active { color: #4A90D9; border-bottom-color: #4A90D9; }
.admin-list { max-height: 50vh; overflow-y: auto; }
.admin-search { padding: 0 0 12px 0; }
.admin-search input {
  width: 100%; padding: 10px 14px; border: 1.5px solid #e0e0e0;
  border-radius: 10px; font-size: 14px; outline: none;
}
.admin-search input:focus { border-color: #4A90D9; }
.admin-user-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid #f5f5f5;
}
.admin-user-info { display: flex; align-items: center; gap: 10px; }
.admin-user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #e8edf2;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.admin-user-name { font-size: 15px; font-weight: 500; }
.admin-user-time { font-size: 11px; color: #bbb; }
.admin-actions { display: flex; gap: 8px; }
.btn-approve, .btn-reject {
  padding: 6px 14px; border-radius: 14px; font-size: 13px;
  border: none; cursor: pointer; transition: opacity 0.15s;
}
.btn-approve { background: #4CAF50; color: #fff; }
.btn-reject { background: #FF6B6B; color: #fff; }
.btn-approve:active, .btn-reject:active { opacity: 0.7; }
.badge-status {
  font-size: 11px; padding: 3px 10px; border-radius: 10px;
}
.badge-approved { background: #e8f5e9; color: #4CAF50; }
.badge-rejected { background: #ffebee; color: #FF6B6B; }

.mine-comment-note {
  font-size: 13px; color: #666; padding: 8px 14px; margin: 0 14px 12px;
  background: #f8f8f8; border-radius: 8px;
}
/* 密码规则提示 */
.pwd-rules { display: block; margin-top: 8px; margin-bottom: 8px; }
.rule { display: block; font-size: 12px; padding: 2px 0; }
.rule.ok { color: #4CAF50; }
.rule-fail { color: #ccc; }
/* 删除按钮 */
.act-delete { color: #FF6B6B !important; }
.act-delete:active { opacity: 0.6; }
.comment-del-btn { color: #FF6B6B; cursor: pointer; font-size: 13px; margin-left: 8px; }
.comment-del-btn:active { opacity: 0.6; }
.btn-disable {
  padding: 6px 14px; border-radius: 14px; font-size: 13px;
  border: none; cursor: pointer; transition: opacity 0.15s;
  background: #FF6B6B; color: #fff;
}
.btn-disable:active { opacity: 0.7; }

/* 图片查看器 */
.img-viewer {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.9); justify-content: center; align-items: center;
  cursor: pointer;
}
.img-viewer.active { display: flex; }
.img-viewer img {
  max-width: 95vw; max-height: 95vh; object-fit: contain;
  border-radius: 4px;
}

/* ??? */
.search-bar {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.search-bar input:focus { border-color: #667eea; }
.sort-tabs {
  display: flex;
  gap: 4px;
  background: #f0f0f0;
  border-radius: 16px;
  padding: 3px;
}
.sort-tab {
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
  white-space: nowrap;
}
.sort-tab.active {
  background: #667eea;
  color: #fff;
}
.load-more { padding: 16px; text-align: center; }
.load-more button {
  background: #f0f0f0;
  border: none;
  padding: 10px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  color: #666;
}
.load-more button:hover { background: #e0e0e0; }

/* ????? */
.admin-search { display: flex; gap: 8px; align-items: center; }
.admin-search input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.bw-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: #f8f8f8; border-radius: 8px; margin-bottom: 6px; }
.bw-item span { font-size: 15px; font-weight: 500; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 6px; cursor: pointer; border: none; }
.btn-primary { background: #4a90d9; color: #fff; }
.btn-primary:hover { background: #357abd; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
