/* ===== 基础 ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #222;
  background: #fff;
}
a { color: #222; text-decoration: none; }
a:hover { color: #315efb; }

/* ===== 顶部栏 ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; font-size: 13px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 18px; }
.top-link { color: #333; }
.top-link:hover { color: #315efb; }
.ip-tag {
  color: #9195a3; font-size: 12px;
  background: #f5f5f6; padding: 3px 8px; border-radius: 999px;
}
.nick-display {
  color: #4e6ef2; font-weight: 600; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-nick {
  background: #4e6ef2; color: #fff; border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.btn-nick:hover { background: #3956d7; }
.btn-admin {
  background: #de0a19; color: #fff; border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.btn-admin:hover { background: #b50a16; }

/* ===== 主体 ===== */
.main { padding-top: 24px; padding-bottom: 40px; }
.search-section { text-align: center; }
.logo {
  font-size: 64px; font-weight: 700; letter-spacing: -2px;
  margin: 0 0 18px 0; cursor: default; user-select: none;
}
.logo-red { color: #de0a19; }
.logo-blue { color: #4e6ef2; }

/* 搜索框 */
.search-box {
  display: inline-flex; align-items: center;
  width: 100%; max-width: 640px; margin: 0 auto;
}
.search-input {
  flex: 1; height: 46px; padding: 0 14px;
  border: 2px solid #c4c7ce; border-right: none;
  border-radius: 12px 0 0 12px; outline: none; font-size: 15px;
}
.search-input:focus { border-color: #4e6ef2; }
.upload-btn {
  height: 46px; width: 46px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-top: 2px solid #c4c7ce; border-bottom: 2px solid #c4c7ce;
  cursor: pointer; font-size: 18px; user-select: none;
}
.upload-btn:hover { background: #f5f7ff; }
.search-btn {
  height: 46px; padding: 0 24px; background: #4e6ef2; color: #fff;
  border: none; border-radius: 0 12px 12px 0; font-size: 15px; cursor: pointer;
}
.search-btn:hover { background: #3956d7; }

/* 操作栏 */
.action-bar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 640px; margin: 12px auto 0;
}
.btn-post {
  background: #4e6ef2; color: #fff; border: none; border-radius: 8px;
  padding: 7px 16px; font-size: 14px; cursor: pointer;
}
.btn-post:hover { background: #3956d7; }
.search-tip { color: #9195a3; font-size: 13px; }

/* 标签页 */
.tabs {
  display: flex; justify-content: center; gap: 32px;
  border-bottom: 1px solid #f0f0f0; margin-top: 22px;
  max-width: 800px; margin-left: auto; margin-right: auto;
}
.tab {
  position: relative; padding: 10px 2px; font-size: 14px; color: #222;
  cursor: pointer; user-select: none;
}
.tab:hover { color: #4e6ef2; }
.tab.active {
  color: #4e6ef2; font-weight: 700;
}
.tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: #4e6ef2; border-radius: 2px 2px 0 0;
}
.tab-badge {
  position: absolute; top: 2px; right: -14px;
  background: #de0a19; color: #fff; font-size: 10px;
  padding: 1px 5px; border-radius: 999px; display: none;
}
.tab-badge.show { display: inline-block; }

/* ===== 内容区 ===== */
.content {
  max-width: 800px; margin: 0 auto; padding: 18px 16px 40px; min-height: 320px;
}

/* 帖子卡片 */
.post-card {
  padding: 16px; border: 1px solid #e4e6eb; border-radius: 12px;
  margin-bottom: 14px; background: #fafbfc; cursor: pointer;
  transition: box-shadow .15s;
}
.post-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.post-card.pinned {
  border-color: #ff9812;
  background: #fffbf2;
}
.post-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.pin-badge {
  background: #ff9812; color: #fff; font-size: 11px;
  padding: 1px 6px; border-radius: 4px;
}
.post-type {
  background: #4e6ef2; color: #fff; font-size: 11px;
  padding: 1px 6px; border-radius: 4px;
}
.post-author {
  color: #4e6ef2; font-weight: 700; font-size: 14px;
}
.post-meta {
  color: #9195a3; font-size: 12px;
}
.post-title {
  font-size: 17px; font-weight: 700; color: #2440b3;
  margin-bottom: 8px; line-height: 1.4;
}
.post-body {
  font-size: 14px; color: #333; line-height: 1.7;
  word-break: break-word;
}
.post-img {
  max-width: 260px; max-height: 200px; border-radius: 8px;
  margin-top: 8px; object-fit: cover; border: 1px solid #e4e6eb;
  cursor: zoom-in;
}

/* 普通消息 */
.msg-item {
  padding: 14px 0; border-bottom: 1px solid #f0f0f0;
}
.msg-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.msg-author {
  color: #4e6ef2; font-weight: 700; font-size: 14px;
}
.msg-meta {
  color: #9195a3; font-size: 12px;
}
.msg-body {
  font-size: 14px; color: #333; line-height: 1.7;
  word-break: break-word;
}
.msg-img {
  max-width: 220px; max-height: 160px; border-radius: 8px;
  margin-top: 6px; object-fit: cover; border: 1px solid #e4e6eb;
  cursor: zoom-in;
}

/* 操作栏 */
.msg-actions {
  margin-top: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.msg-action {
  font-size: 12px; color: #9195a3; cursor: pointer; user-select: none;
}
.msg-action:hover { color: #4e6ef2; }
.admin-action {
  font-size: 12px; color: #de0a19; cursor: pointer; user-select: none;
}
.admin-action:hover { color: #b50a16; }

/* 回复折叠区 */
.replies-wrap {
  margin-top: 10px; padding-left: 14px;
  border-left: 2px solid #e4e6eb;
}
.reply-item {
  padding: 8px 0; font-size: 13px; color: #555;
  border-bottom: 1px dashed #eee;
}
.reply-item:last-child { border-bottom: none; }
.reply-author {
  color: #4e6ef2; font-weight: 600; margin-right: 4px;
}
.reply-body {
  color: #444; line-height: 1.6; word-break: break-word;
}
.reply-img {
  max-width: 160px; max-height: 120px; border-radius: 6px;
  margin-top: 4px; object-fit: cover; border: 1px solid #e4e6eb;
  cursor: zoom-in;
}
.replies-more {
  font-size: 12px; color: #9195a3; cursor: pointer; padding: 6px 0;
}
.replies-more:hover { color: #4e6ef2; }

/* 就地回复输入框 */
.inline-reply-box {
  display: none; align-items: center; gap: 8px;
  margin-top: 10px; padding: 10px; background: #f5f7ff; border-radius: 8px;
}
.inline-reply-box.show { display: flex; }
.inline-reply-input {
  flex: 1; height: 36px; padding: 0 10px; border: 1px solid #d3d3d3;
  border-radius: 6px; outline: none; font-size: 13px;
}
.inline-reply-btn {
  background: #4e6ef2; color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 13px; cursor: pointer;
}

/* ===== 帖子详情弹窗 ===== */
.modal-xl {
  width: 92%; max-width: 720px; max-height: 88vh;
  display: flex; flex-direction: column; padding: 0;
}
.thread-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
}
.thread-header h3 { margin: 0; font-size: 18px; }
.thread-close {
  background: none; border: none; font-size: 24px; color: #999; cursor: pointer;
}
.thread-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.thread-footer {
  display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid #f0f0f0;
}
.thread-reply-input {
  flex: 1; height: 38px; padding: 0 12px; border: 1px solid #d3d3d3;
  border-radius: 8px; outline: none; font-size: 14px;
}
.thread-post {
  padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; margin-bottom: 12px;
}
.thread-post-title {
  font-size: 18px; font-weight: 700; color: #222; margin-bottom: 8px;
}
.thread-post-body {
  font-size: 14px; color: #333; line-height: 1.7; word-break: break-word;
}
.thread-post-img {
  max-width: 100%; max-height: 300px; border-radius: 8px;
  margin-top: 8px; object-fit: cover; cursor: zoom-in;
}

/* ===== 通用弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay[aria-hidden="false"] { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 24px; width: 92%; max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
.modal-wide { max-width: 520px; }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal-input {
  width: 100%; height: 42px; padding: 0 12px; font-size: 15px;
  border: 1px solid #d3d3d3; border-radius: 8px; outline: none; margin-bottom: 12px;
}
.modal-input:focus { border-color: #4e6ef2; }
.modal-textarea {
  width: 100%; min-height: 120px; padding: 10px 12px; font-size: 15px;
  border: 1px solid #d3d3d3; border-radius: 8px; outline: none; margin-bottom: 12px;
  resize: vertical; font-family: inherit;
}
.modal-textarea:focus { border-color: #4e6ef2; }
.modal-upload-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.upload-filename { font-size: 13px; color: #666; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-secondary {
  background: #f5f5f6; color: #222; border: none; border-radius: 8px;
  padding: 8px 16px; cursor: pointer;
}
.btn-primary {
  background: #4e6ef2; color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; cursor: pointer;
}

/* ===== 图片预览弹窗 ===== */
.img-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.img-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.7); cursor: zoom-out;
}
.img-modal-img {
  position: relative; max-width: 92vw; max-height: 90vh;
  border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

/* ===== 页脚 ===== */
.footer {
  text-align: center; font-size: 12px; color: #9195a3; padding: 24px 16px;
}
.footer-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; flex-wrap: wrap; }
.footer a { color: #9195a3; }
.footer a:hover { color: #315efb; }

/* ===== 空状态 ===== */
.empty-tip {
  color: #9195a3; text-align: center; padding: 40px 0; font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .topbar { flex-direction: column; gap: 8px; }
  .logo { font-size: 48px; }
  .search-box { max-width: 92vw; }
  .tabs { gap: 18px; }
  .modal-xl { max-height: 92vh; }
  .action-bar { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* 主题切换按钮 */
.theme-bar {
  display: flex; align-items: center; gap: 6px;
}
.theme-label { font-size: 14px; cursor: default; }
.theme-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; background: #f5f5f6; color: #333;
}
.theme-btn:hover { background: #e8e8e8; }
.theme-btn.active {
  border-color: #4e6ef2; background: #eef1ff; color: #4e6ef2;
}

/* 帖子详情上传按钮 */
.thread-upload {
  height: 38px; width: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; border-radius: 8px;
  background: #f5f5f6; margin-right: 4px;
}
.thread-upload:hover { background: #e8e8e8; }
