/* ========== 明暗主题变量 ========== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
:root {
  --bg-light: #f8f9fa;
  --bg-dark: #1c1c1e;
  --text-main-light: #222222;
  --text-main-dark: #f1f1f1;
  --text-second-light: #86868b;
  --text-second-dark: #98989d;
  --line-light: #e5e5ea;
  --line-dark: #38383a;
  --reply-line-light: #eeeeee;
  --reply-line-dark: #2c2c2e;

  --blue: #007aff;
  --blue-dark: #0051b8;
  --red: #ff3b30;
  --red-dark: #d92e24;
  --green: #34c759;

  --fs-xs: 15px;
  --fs-sm: 15px;
  --fs-md: 15px;
  --fs-lg: 15px;
}

.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-md { font-size: var(--fs-md); }
.fs-lg { font-size: var(--fs-lg); }

/* 亮色/暗色主题 */
@media (prefers-color-scheme: light) {
  :root {
    --bg: var(--bg-light);
    --text-main: var(--text-main-light);
    --text-second: var(--text-second-light);
    --border-line: var(--line-light);
    --reply-border: var(--reply-line-light);
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--bg-dark);
    --text-main: var(--text-main-dark);
    --text-second: var(--text-second-dark);
    --border-line: var(--line-dark);
    --reply-border: var(--reply-line-dark);
  }
  .msg-media-wrap, .msg-media-img, .msg-media-video {
    background: #0a0a0a;
  }
}

/* 全局重置 + 移动端点击高亮清除 */
*{
  margin:0;
  padding:0;
  box-sizing:border-box;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}
button, input, textarea {
  font-family: inherit;
}

/* ========== 三段式核心布局 ========== */
/* 顶部状态栏 */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  border-bottom: 2px solid var(--border-line);
  background: var(--bg);
  padding: 8px 12px; /* 稍微压缩垂直 Padding，避免导航栏过厚 */
}
.top-bar-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  height: 28px; /* 增加固定中轴高度，确保左右两端与中间标题严格垂直居中 */
}
.back-link,
.notify-link,
.post-btn-top {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  
  font-family: inherit;
  font-size: var(--fs-md);
  color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
  
  /* 精确对齐与呼吸感内边距 */
  padding: 4px 6px !important;
  margin: 0 !important;
  
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 6px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

/* 悬浮与点击状态 */
.back-link:hover,
.notify-link:hover,
.post-btn-top:hover {
  background-color: rgba(0, 122, 255, 0.08) !important; /* 微浅蓝悬浮背景，增加质感 */
}
.back-link:active,
.notify-link:active,
.post-btn-top:active {
  opacity: 0.5;
}

.view-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-main);
  font-weight: 600; /* 加粗中间标题，增加主次对比 */
  pointer-events: none;
  font-size: var(--fs-md);
  line-height: 1;
  white-space: nowrap;
}

/* 右侧按钮组 */
.nav-right-group {
  display: flex;
  gap: 6px; /* 优化按钮之间的物理距离 */
  align-items: center;
  line-height: 1;
  z-index: 1;
  margin-left: auto;
  padding-right: 18px;
}

/* 中间内容区 */
.main-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 60px 12px 20px;
  transition: padding-bottom 0.24s ease;
}
.main-container.editor-open {
  padding-bottom: 180px;
}
.load-tip {
  text-align: center;
  padding: 18px 0;
  color: var(--text-second);
  cursor: default;
}

/* 底部常驻输入区 */
.bottom-input {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg);
  border-top: 2px solid var(--border-line);
  padding: 10px 12px;
  z-index: 999;
  transform: translateY(100%);
  transition: transform 0.24s ease;
}
.bottom-input.show {
  transform: translateY(0);
}
.bottom-input form {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bottom-input textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: var(--fs-lg);
  resize: none;
  min-height: 36px;
}
.input-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 文字按钮通用 */
.reply-small-btn,
.text-btn {
  background: transparent;
  border: none;
  color: var(--blue);
  font-size: var(--fs-md);
  cursor: pointer;
}
.reply-small-btn:hover,
.text-btn:hover {
  color: var(--blue-dark);
}
.text-btn:disabled {
  color: var(--text-second);
  cursor: not-allowed;
}

/* 主按钮 */
.primary-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: var(--fs-md);
  cursor: pointer;
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 媒体预览与进度 */
.media-preview-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.media-preview-box img,
.media-preview-box video {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1px solid var(--border-line);
}
.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--border-line);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--blue);
  transition: width 0.1s linear;
}
.progress-text {
  color: var(--text-second);
  margin-top: 2px;
}

/* ========== 帖子卡片 ========== */
.post-card {
  background: transparent;
  border-left: 4px solid var(--blue);
  padding: 12px 12px 14px 14px;
  margin-bottom: 24px;
}
.post-card:hover {
  background: rgba(0, 122, 255, 0.06);
}
.post-info{
  display:flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 8px;
}
.post-author,
.reply-name {
  color:var(--blue);
  font-size: var(--fs-sm);
}
.post-author {
  font-weight:500;
}
.post-time,
.reply-time,
.page-notify-time {
  color:var(--text-second);
  font-size: var(--fs-xs);
}
.post-content,
.reply-text {
  color: var(--text-main);
  line-height: 1.4;
  white-space: pre-line;
  overflow-wrap: break-word;
  word-break: break-all;
}
.post-content {
  margin-bottom:4px;
  font-size: var(--fs-lg);
}
.post-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  line-height: 1;
}
.post-btn-group{
  display:flex;
  justify-content:flex-end;
  gap:6px;
}

/* ========== 回复区域 ========== */
.reply-wrap {
  counter-reset: floorNum;
  margin-top: 12px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 2px solid var(--border-line);
}
.reply-item {
  margin: 10px 0;
  padding: 8px 0;
  border-bottom: 1px dashed var(--reply-border);
}
.reply-item:last-child {
  border-bottom: none;
}
.reply-head{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}
.reply-head::after {
  counter-increment: floorNum;
  content: counter(floorNum) "楼";
  color: var(--text-second);
  font-size: var(--fs-xs);
}
.reply-avatar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reply-text {
  margin:2px 0;
  font-size: var(--fs-md);
}
.reply-time {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.reply-small-btn {
  padding:2px 4px;
  margin-top:3px;
}
.reply-small-btn.del-btn {
  color:var(--red);
}
.reply-small-btn.del-btn:hover {
  color:var(--red-dark);
}

/* 统一头像 */
.post-avatar, .reply-avatar {
  width: 34px;
  height: 34px;
  border-radius: 0;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border-line);
  background-color: var(--bg);
}
.post-avatar-row, .reply-avatar-row {
  line-height: 1;
}

/* 评论折叠按钮 */
.toggle-wrapper {
  display: block;
  padding: 6px 0;
  cursor: pointer;
}
.fold-btn {
  color: var(--blue);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px 2px 0;
  transition: color 0.2s ease;
  font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 3px;
}
.fold-btn::before {
  content: "💬";
}
.fold-btn::after {
  content: attr(data-reply-count);
}
.fold-btn:hover {
  color: var(--blue-dark);
}

/* 超链接 */
.post-content a, .reply-text a {
  color: var(--blue);
  text-decoration: underline;
}
.post-content a:hover, .reply-text a:hover {
  color: var(--blue-dark);
}

/* 媒体图片视频 */
.msg-media-wrap {
  width: fit-content;
  max-width: min(100%, 420px);
  margin: 8px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-line);
  background: var(--bg);
}
.msg-media-img, .msg-media-video {
  width: auto;
  height: auto;
  max-width: 420px;
  max-height: 55vh;
  object-fit: contain;
  display: block;
  loading: lazy;
  background: var(--bg);
}

/* 高亮动画 */
@keyframes flash-highlight {
  0% { background-color: rgba(0,122,255,0.15); }
  50% { background-color: transparent; }
  100% { background-color: rgba(0,122,255,0.15); }
}
.flash {
  animation: flash-highlight 0.6s ease-in-out 2;
}

/* ========== 通知列表 ========== */
.page-notify-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 4px solid var(--blue);
  cursor: pointer;
}
.page-notify-item:last-child {
  margin-bottom: 0;
}
.page-notify-text {
  color: var(--text-main);
  line-height: 1.4;
  font-size: var(--fs-md);
}
.page-notify-text.unread::before {
  content: "● ";
  color: var(--text-second);
}
.page-notify-time {
  text-align: left;
  margin-top: 4px;
}
.notify-op-row {
  margin-top: 20px;
  display: flex;
  gap: 16px;
}
.notify-op-row .text-btn {
  padding: 0;
}
.empty-tip{
  text-align:center;
  padding:30px 0;
  color:var(--text-second);
}

/* 禁止可点击元素文本选中，解决Chrome误选弹搜索框 */
.back-link,
.view-title,
.notify-link,
.post-btn-top,
.page-notify-item,
.fold-btn,
.toggle-wrapper,
.reply-small-btn,
.text-btn {
  -webkit-user-select: none;
  user-select: none;
}

/* 帖子正文、回复正文保留可选中 */
.post-content,
.reply-text {
  -webkit-user-select: text;
  user-select: text;
}
/* 分享复制轻提示Toast */
.toast-tip {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  border-radius: 999px;
  font-size: var(--fs-sm);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
  z-index: 99999;
}
.toast-tip.show {
  opacity: 1;
}