* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #ffffff;
  background-attachment: fixed;
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
  color: #333;
}
.wrap { width: 100%; max-width: 640px; }
h1 {
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  margin-bottom: 20px;
}
.field { margin-bottom: 12px; }
label { display: block; font-size: 13px; color: #888; margin-bottom: 6px; }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus {
  border-color: #764ba2;
  box-shadow: 0 0 0 3px rgba(118,75,162,.12);
}
textarea { resize: vertical; min-height: 88px; }
.actions { display: flex; align-items: center; gap: 12px; }
button {
  padding: 12px 26px;
  border: none;
  border-radius: 10px;
  background: #764ba2;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .12s;
}
button:hover:not(:disabled) { background: #5b3791; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: not-allowed; }
#formStatus { font-size: 13px; color: #888; }
#formStatus.err { color: #d33; }
#formStatus.ok { color: #2a9d4a; }
.hint { font-size: 12px; color: #aaa; text-align: right; }
.profile-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 8px;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.profile-btn:hover { background: rgba(255,255,255,.3); }
.list { display: flex; flex-direction: column; gap: 12px; }
.msg {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.msg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.msg-nick { display: inline-flex; align-items: center; font-weight: 600; color: #333; word-break: break-all; }
.msg-avatar { margin-right: 6px; font-size: 18px; }
.msg-time { font-size: 12px; color: #aaa; white-space: nowrap; }
.msg-meta { display: flex; align-items: center; gap: 10px; }
.del-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: #f0f0f0;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.del-btn:hover { background: #ffe0e0; color: #d33; }
.msg-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.act-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: #f4f4f6;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.act-btn:hover { background: #e8e8f5; color: #764ba2; }
.act-btn .cnt { color: #999; font-size: 12px; margin-left: 2px; }
.act-btn.voted { background: #764ba2; color: #fff; }
.act-btn.voted .cnt { color: #fff; }
.act-btn.voted:hover { background: #5b3791; }
.edit-area { margin-top: 4px; }
.edit-area textarea { min-height: 66px; margin-bottom: 8px; }
.edit-row { display: flex; gap: 8px; }
.mini-btn { padding: 6px 14px; border: none; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 600; }
.mini-btn.save { background: #764ba2; color: #fff; }
.mini-btn.save:hover { background: #5b3791; }
.mini-btn.cancel { background: #ececef; color: #888; }
.mini-btn.cancel:hover { background: #dedee3; }
.emoji-bar { margin-top: 6px; }
.emoji-btn {
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: 14px;
  cursor: pointer;
}
.emoji-btn:hover { background: #f4f4f6; }
.emoji-panel { display: none; flex-wrap: wrap; gap: 4px; padding: 8px; margin-top: 6px; background: #f7f7f9; border-radius: 8px; }
.emoji-panel span { font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1.4; }
.emoji-panel span:hover { background: #e3e3ea; }
.msg-body {
  color: #444;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}
#emptyHint { text-align: center; color: #fff; opacity: .85; padding: 24px; }
#loadStatus { color: #fff; text-align: center; padding: 24px; opacity: .85; }

/* 顶部登录区 */
.auth-bar { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 16px; min-height: 36px; }
.cur-user { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.logout-btn { padding: 6px 14px; border: none; border-radius: 999px; background: rgba(255,255,255,.25); color: #fff; font-size: 13px; cursor: pointer; margin-left: 8px; font-weight: 600; }
.logout-btn:hover { background: rgba(255,255,255,.4); }
.login-btn { padding: 8px 20px; border: none; border-radius: 999px; background: #fff; color: #764ba2; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-btn:hover { background: #f0eaff; }
.post-as { font-size: 13px; color: #888; margin-bottom: 10px; }
.post-as .who { color: #764ba2; font-weight: 600; }

/* 登录/注册弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 380px; margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 20px; font-weight: 600; color: #333; }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; color: #aaa; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: #333; background: none; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-picker span { font-size: 24px; cursor: pointer; padding: 4px 6px; border-radius: 8px; border: 2px solid transparent; line-height: 1.2; }
.avatar-picker span:hover { background: #f0f0f0; }
.avatar-picker span.sel { border-color: #764ba2; background: #f3eefa; }
.auth-switch { margin-top: 12px; font-size: 13px; color: #888; text-align: center; }
.auth-switch a { color: #764ba2; cursor: pointer; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
#authStatus { font-size: 13px; color: #888; }
#authStatus.err { color: #d33; }
#authStatus.ok { color: #2a9d4a; }

/* 密码可见性切换 */
input[type="password"]::-ms-reveal { display: none !important; }
.pwd-field { position: relative; }
.pwd-field input { padding-right: 40px; }
.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  line-height: 0;
}
.pwd-toggle:hover { color: #764ba2; }
.pwd-toggle svg { position: absolute; transition: opacity .15s ease; }
.pwd-toggle .eye-off { opacity: 0; }
.pwd-toggle.on .eye-on { opacity: 0; }
.pwd-toggle.on .eye-off { opacity: 1; }

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1;
  min-width: 0;
}
.search-bar button {
  padding: 10px 18px;
  font-size: 14px;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
}
.page-btn:hover { background: rgba(255,255,255,.25); }
.page-btn.active { background: #fff; color: #764ba2; font-weight: 600; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-ellipsis { color: rgba(255,255,255,.6); padding: 0 4px; font-size: 13px; }
.pager-jump { width: 64px; padding: 4px 8px; border: 1px solid #ccc; border-radius: 8px; background: #fff; color: #333; font-size: 14px; text-align: center; }
.pager-jump-btn { padding: 6px 12px; border: 1px solid #fff; border-radius: 8px; background: #fff; color: #333; font-size: 14px; cursor: pointer; }
.pager-jump-btn:hover { background: #f0f0f0; }
.page-dots { color: rgba(255,255,255,.7); padding: 0 4px; }

/* 排序下拉 */
.sort-select {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}
.sort-select option { color: #333; }

/* 主题切换按钮 */
/* 回复列表 */
.reply-list {
  margin-top: 10px;
  padding-left: 16px;
  border-left: 3px solid rgba(118,75,162,.2);
}
.reply-list:empty { display: none; }
.msg.reply {
  background: #f8f8fb;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 8px;
  font-size: 14px;
}
.msg.reply .msg-head { margin-bottom: 4px; }

/* 嵌套回复：随层级加深缩进 */
.msg.reply[data-depth="2"] { margin-left: 12px; }
.msg.reply[data-depth="3"] { margin-left: 24px; }
.msg.reply[data-depth="4"],
.msg.reply[data-depth="5"],
.msg.reply[data-depth="6"] { margin-left: 36px; }

/* 回复指向提示 */
.reply-to {
  display: inline-block;
  font-size: 12px;
  color: #8a6d3b;
  background: #f6f3e8;
  border-radius: 6px;
  padding: 1px 8px;
  margin-bottom: 6px;
}
.reply-to b { font-weight: 600; color: #764ba2; }

/* 展开/收起回复按钮 */
.expand-reply-btn {
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px dashed rgba(118,75,162,.4);
  border-radius: 6px;
  background: transparent;
  color: #764ba2;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.expand-reply-btn:hover { background: rgba(118,75,162,.08); }

/* 回复表单 */
.reply-form {
  margin-top: 8px;
}
.reply-form textarea {
  min-height: 50px;
  margin-bottom: 8px;
  font-size: 14px;
}

/* 暗色模式 */
/* 背景设置 */
.bg-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.bg-preset {
  width: 48px; height: 36px; border-radius: 8px; cursor: pointer;
  border: 2px solid #ddd; transition: transform .15s, border-color .15s;
}
.bg-preset:hover { transform: scale(1.1); border-color: #764ba2; }
.bg-custom-row { display: flex; align-items: center; gap: 6px; }
.bg-custom-row input[type="color"] {
  width: 44px; height: 36px; padding: 2px; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; background: none;
}
.bg-apply-btn, .bg-reset-btn {
  padding: 8px 16px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: background .15s;
}
.bg-apply-btn { background: #764ba2; color: #fff; }
.bg-apply-btn:hover { background: #5b3791; }
.bg-reset-btn { background: #f0f0f0; color: #666; }
.bg-reset-btn:hover { background: #e0e0e0; }
/* 用户菜单 */
.cur-user.clickable { cursor: pointer; transition: opacity .2s; }
.cur-user.clickable:hover { opacity: .8; }
.caret { font-size: 12px; opacity: .7; }
.menu-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  vertical-align: top;
  margin-left: 4px;
}
.user-menu {
  position: absolute;
  min-width: 140px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 1000;
  overflow: hidden;
  padding: 4px 0;
}
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  color: inherit;
  transition: background .15s;
}
.menu-item:hover { background: rgba(118,75,162,.08); }
.menu-logout:hover { background: rgba(231,76,60,.1); color: #e74c3c; }
.menu-count {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  padding: 0 3px;
  margin-left: 4px;
}
.notif-modal { max-width: 400px; }
.notif-modal .modal-head { margin-bottom: 0; }
.notif-controls {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  color: #666;
  border-bottom: 1px solid #f5f5f5;
  user-select: none;
}
.notif-controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.notif-controls input { width: auto; }
.notif-pagination { margin-top: 10px; }
.notif-pagination .page-btn {
  border-color: #ddd;
  background: #f5f5f6;
  color: #555;
}
.notif-pagination .page-btn:hover { background: #ececf5; }
.notif-pagination .page-btn.active { background: #764ba2; color: #fff; }
.notif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background .15s;
}
.notif-item:hover { background: rgba(118,75,162,.06); }
.notif-item.unread { background: rgba(118,75,162,.05); }
.notif-avatar { font-size: 18px; flex-shrink: 0; }
.notif-body { display: flex; flex-direction: column; gap: 1px; font-size: 13px; min-width: 0; }
.notif-name { font-weight: 600; }
.notif-type { color: #666; }
.notif-time { font-size: 11px; color: #aaa; }
.notif-content { font-size: 13px; color: #3f3a4d; background: #f6f3fc; border-radius: 8px; padding: 6px 9px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.notif-ref { display: block; margin-top: 3px; font-size: 11px; color: #8a8792; }
.notif-empty { text-align: center; padding: 24px; color: #aaa; font-size: 14px; }

/* @提及 */
.mention {
  color: #764ba2;
  font-weight: 600;
  background: rgba(118,75,162,.1);
  border-radius: 4px;
  padding: 0 3px;
}
/* 图片 */
.msg-nick { cursor: pointer; }
.msg-nick:hover { text-decoration: underline; }
.msg-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}
.image-preview {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  position: relative;
}
.image-preview img {
  max-height: 80px;
  max-width: 120px;
  border-radius: 6px;
  object-fit: cover;
}
.img-remove {
  position: absolute;
  top: -6px;
  left: 104px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 用户主页 */
.profile-modal { max-width: 600px; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 2px solid #f0f0f0;
}
.profile-avatar { font-size: 28px; }
.profile-name { font-weight: 700; font-size: 18px; }
.profile-count { color: #888; font-size: 14px; }
.profile-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }

/* 置顶 */
.msg.pinned { border-left: 4px solid #ffc107; }
.pin-badge { display: inline-block; background: #fff3cd; color: #856404; font-size: 11px; padding: 2px 8px; border-radius: 6px; margin-bottom: 4px; font-weight: 600; }

/* 通知分类标签 */
.notif-tabs { display: none; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.notif-tabs button { border: 1px solid #e3e0ee; background: #f4f3fa; color: #555; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.notif-tabs button.active { background: #764ba2; color: #fff; border-color: #764ba2; }
.notif-tabs button:hover { background: #efe8fb; }

/* 作者主页 Tabs */
.tab-btn { border: 1px solid #dde1e6; background: #fff; color: #555; padding: 7px 18px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.tab-btn.active { background: #764ba2; border-color: #764ba2; color: #fff; }
.tab-btn:hover:not(.active) { background: #f4f1fb; color: #5b3791; }
.article-category-filter .tab-btn + .page-btn { margin-left: 8px; }

/* 关注/私信紫色胶囊按钮 */
.pm-btn {
  background: #764ba2;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s;
}
.pm-btn:hover { background: #5b3791; }
.pm-btn.followed { background: #fff; color: #764ba2; border: 1px solid #b9a0dd; padding: 7px 17px; }
.pm-btn.followed:hover { background: #f6f1fc; }
.pm-btn:disabled { opacity: .6; cursor: not-allowed; }
.profile-head .pm-btn { flex: 0 0 auto; }

/* 粉丝/关注统计（可点击） */
.follow-stat { cursor: pointer; color: #5b3791; }
.follow-stat:hover { text-decoration: underline; }
#pStats .sep { margin: 0 6px; color: #c7c1d8; }
body.layout2 #pStats { color: #9a8fb5; }

/* 粉丝/关注列表条目 */
.follow-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #eceaf3; border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.follow-item:hover { background: #f7f4fc; border-color: #d9ccf0; }
.follow-item .fav-avatar { font-size: 26px; }
.follow-item .fav-name { flex: 1; font-weight: 600; color: #1f2430; text-align: left; background: none; padding: 0; }

/* 每日签到（品牌栏右侧） */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-row .brand { flex: 1; min-width: 0; }
.brand-checkin { flex: 0 0 auto; padding: 6px 12px; border: none; border-radius: 999px; background: linear-gradient(135deg,#e6a23c,#f56c6c); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 6px rgba(230,162,60,.35); }
.brand-checkin:hover { filter: brightness(1.06); }
.brand-checkin:disabled { cursor: default; filter: none; opacity: .85; }
.brand-checkin.checked { background: linear-gradient(135deg,#34c759,#2aa8e0); box-shadow: 0 2px 6px rgba(52,199,89,.3); }
.side-checkin-info { display: block; font-size: 11px; color: #9a8fb5; padding: 2px 4px 8px; line-height: 1.5; }

/* 热榜卡片 */
.lb-tabs { display: flex; gap: 8px; margin: 6px 0 12px; }
.lb-tab { padding: 6px 18px; border: 1px solid #e3dcf3; border-radius: 999px; background: #fff; color: #6b5f8a; font-size: 13px; font-weight: 600; cursor: pointer; }
.lb-tab:hover { border-color: #764ba2; color: #5b3791; }
.lb-tab.active { background: linear-gradient(135deg,#764ba2,#667eea); border-color: transparent; color: #fff; }
.lb-note { font-size: 12px; color: #9a8fb5; margin: -6px 0 12px; }
.lb-card { background: #fff; border: 1px solid #eceaf3; border-radius: 14px; padding: 6px 0; }
.lb-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f1eef7; }
.lb-item:last-child { border-bottom: none; }
.lb-rank { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; color: #8a87a0; background: #f2f0f8; }
.lb-item:nth-child(1) .lb-rank { background: linear-gradient(135deg,#fde68a,#f59e0b); color: #78350f; }
.lb-item:nth-child(2) .lb-rank { background: linear-gradient(135deg,#e5e7eb,#9ca3af); color: #374151; }
.lb-item:nth-child(3) .lb-rank { background: linear-gradient(135deg,#fbcfe8,#d97706); color: #7c2d12; }
.lb-avatar { font-size: 30px; flex: 0 0 auto; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 600; color: #1f2430; }
.lb-lv { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(135deg,#764ba2,#667eea); border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }
#checkinInfo b, .side-checkin-info b { color: #5b3791; }
.sidebar .user-level { margin: -4px 0 10px; padding: 0 4px; }
.sidebar .user-level-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: #5b3791; margin-bottom: 4px; }
.sidebar .user-level-top .user-exp { font-weight: 600; color: #9a8fb5; }
.sidebar .user-level-bar { height: 6px; background: #efe8fb; border-radius: 999px; overflow: hidden; }
.sidebar .user-level-bar i { display: block; height: 100%; background: linear-gradient(135deg,#e6a23c,#f56c6c); border-radius: 999px; }
.sidebar .user-level.full .user-level-bar i { background: linear-gradient(135deg,#764ba2,#667eea); }
.lv-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; line-height: 1; color: #fff; background: linear-gradient(135deg,#764ba2,#667eea); border-radius: 4px; padding: 2px 5px; vertical-align: 1px; white-space: nowrap; }
.lb-likes { font-size: 13px; color: #5b3791; font-weight: 600; flex: 0 0 auto; }
.lb-checkin { font-size: 12px; color: #9a8fb5; flex: 0 0 auto; }
