/* 全局样式 */
:root {
  /* 主色调：经典校园蓝 */
  --primary-color: #2b6cb0;
  --primary-light: #ebf4fc;
  --primary-dark: #245a94;
  --secondary-color: #1e4e79;

  /* 语义颜色 */
  --success-color: #2f9e44;
  --success-dark: #2b8a3e;
  --error-color: #e03131;
  --error-dark: #c92a2a;
  --warning-color: #f08c00;
  --warning-dark: #e8590c;
  --info-color: #1971c2;
  --info-dark: #1864ab;
  --favorite-color: #e67700;
  --favorite-dark: #d9480f;
  --dislike-color: #d6336c;
  --dislike-dark: #c2255c;

  /* 文字颜色 */
  --text-color: #1f2328;
  --text-light: #57606a;
  --text-muted: #8c959f;

  /* 背景颜色 */
  --background-light: #f6f7f8;
  --background-card: #ffffff;
  --background-hover: #f0f1f2;

  /* 边框 */
  --border-color: #e4e6e8;
  --border-light: #f0f1f2;

  /* 图标 */
  --icon-color: #57606a;

  /* 圆角：全部直角（去 AI 大圆角风格）；--radius-full 保留圆形（头像等） */
  --radius-xs: 0;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  --radius-pill: 0;
  --radius-full: 50%;

  /* 阴影：极淡，仅用于层级区分 */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.10);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.09);

  /* 过渡动效 */
  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.3s ease;

  /* 按钮内边距 */
  --btn-padding-sm: 6px 14px;
  --btn-padding-md: 10px 20px;
  --btn-padding-lg: 12px 28px;
  --btn-font-size: 14px;
  --btn-font-size-sm: 13px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--background-light);
  color: var(--text-color);
  line-height: 1.6;
}

/* 页眉 */
header {
  background: var(--primary-color);
  color: white;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo i {
  font-size: 28px;
}

.logo h1 {
  font-size: 22px;
  font-weight: 600;
}

/* Header 搜索框 */
.header-search {
  flex: 1;
  max-width: 500px;
  margin: 0 30px;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  /* 搜索框保留圆角（胶囊），不受全局直角影响 */
  border-radius: 25px;
  padding: 0 5px;
  transition: var(--transition);
}

.search-box-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.search-box-wrapper > i.fa-search {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  padding: 0 12px;
}

.search-box-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 14px;
  padding: 10px 5px;
  outline: none;
  min-width: 150px;
}

.search-box-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-clear-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition-fast);
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.search-btn {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: white;
  padding: 8px 18px;
  /* 搜索按钮与搜索框一致保留圆角 */
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-left: 5px;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* 搜索历史下拉 */
.search-history {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--background-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}

.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-light);
}

.clear-history-btn {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.clear-history-btn:hover {
  background: var(--background-light);
  color: var(--error-color);
}

.search-history-list {
  max-height: 250px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.history-item:hover {
  background: var(--background-light);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-color);
  font-size: 14px;
}

.history-item-left i {
  color: var(--text-light);
  font-size: 12px;
}

.history-item-delete {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: var(--error-color);
  background: rgba(239, 68, 68, 0.1);
}

.search-empty-history {
  padding: 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

.notification-area {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 380px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#user-actions {
  display: flex;
  gap: 10px;
}

#user-actions button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

#user-actions button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.logout-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 顶栏图标按钮通用样式 */
.header-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

.header-icon-btn a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  min-height: 50px;
  padding: 5px 4px 4px;
  border-radius: var(--radius-md);
  background: var(--background-card);
  color: var(--text-color);
  transition: var(--transition);
  text-decoration: none;
  border: 1px solid var(--border-color);
  gap: 2px;
}

.header-icon-btn a:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.header-icon-btn i {
  font-size: 16px;
  line-height: 1;
}

.header-icon-btn .btn-label {
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}


/* =============================================
   通知徽章（角标）公共底座
   ============================================= */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.notification-badge:not(:empty) {
  animation: badge-pulse 2s ease-in-out infinite;
}

/* 消息徽章 */
.message-badge {
  background: var(--error-color);
}

/* 更新动态徽章 */
.updates-badge {
  background: var(--success-color);
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* 主体内容布局 */
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

.main-content {
  display: grid;
  /* 关键：1fr 的轨道最小值默认是 auto(=min-content)，子项一旦有较宽的
     flex/nowrap 内容就会把轨道撑得比容器还宽，表现为手机端"元素被挤出屏幕"。
     显式写 minmax(0, 1fr) 让轨道可以收缩到 0。 */
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 900px) {
  .main-content {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}

/* 卡片样式 */
.post-form, 
.statistics-card, 
.guidelines-card, 
.user-panel,
.post {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  color: var(--primary-color);
}

.comments-closed-badge {
  display: inline-block;
  background: var(--error-color);
  color: white;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: 8px;
  font-weight: normal;
  vertical-align: middle;
}

/* 帖子列表区域 */
.posts-section {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.posts-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 15px;
}

.posts-section-header .section-title {
  margin-bottom: 0;
}

/* 搜索结果提示 */
.search-results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 15px;
  font-size: 14px;
}

.search-results-info span {
  color: var(--text-color);
}

.search-results-info span::before {
  content: '搜索 "';
  color: var(--text-light);
}

.search-results-info span::after {
  content: '" 的结果';
  color: var(--text-light);
}

.clear-search-btn {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.clear-search-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* 排序选项 */
.sort-options {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  background: var(--background-card);
  border-radius: var(--radius-md);
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
}

.sort-label {
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
}

.sort-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sort-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.sort-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 表单组件 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-light);
}

input[type="text"], 
input[type="password"],
textarea, 
select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--background-card);
  color: var(--text-color);
  transition: var(--transition);
}

input[type="text"]:focus, 
input[type="password"]:focus,
textarea:focus, 
select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* 新增：横向排列的表单行 */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.form-row .form-group {
  flex: 1;
  min-width: 150px;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
}

/* 按钮样式 */
.post-button, .login-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.post-button:hover, .login-button:hover {
  background: var(--secondary-color);
}

/* 复选框容器 */
.anonymous-container {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.anonymous-container input {
  margin-right: 10px;
  width: 18px;
  height: 18px;
}

.anonymous-container label {
  font-size: 15px;
  color: var(--text-light);
}

/* 通知消息 - 现代通知系统 */
.notification-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 0;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.notification-message.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-message.hide {
  opacity: 0;
  transform: translateX(100%);
}

/* 通知图标圆 */
.notification-message .notification-icon-circle {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* 通知内容区 */
.notification-message .notification-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-message .notification-body span {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

/* 关闭按钮 */
.notification-message .notification-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: var(--radius-full);
  opacity: 0.5;
  transition: var(--transition-fast);
  padding: 0;
  color: inherit;
}

.notification-message .notification-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* 进度条 */
.notification-message .notification-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: notification-progress 3s linear forwards;
}

@keyframes notification-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* 类型变体 */
.notification-message.info {
  background: rgba(33, 150, 243, 0.08);
  border: 1px solid rgba(33, 150, 243, 0.15);
  color: var(--info-color);
}

.notification-message.info .notification-icon-circle {
  background: rgba(33, 150, 243, 0.15);
  color: var(--info-color);
}

.notification-message.info .notification-progress {
  background: var(--info-color);
}

.notification-message.success {
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.15);
  color: var(--success-color);
}

.notification-message.success .notification-icon-circle {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success-color);
}

.notification-message.success .notification-progress {
  background: var(--success-color);
}

.notification-message.error {
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.15);
  color: var(--error-color);
}

.notification-message.error .notification-icon-circle {
  background: rgba(244, 67, 54, 0.15);
  color: var(--error-color);
}

.notification-message.error .notification-progress {
  background: var(--error-color);
}

.notification-message.warning {
  background: rgba(255, 152, 0, 0.08);
  border: 1px solid rgba(255, 152, 0, 0.15);
  color: var(--warning-color);
}

.notification-message.warning .notification-icon-circle {
  background: rgba(255, 152, 0, 0.15);
  color: var(--warning-color);
}

.notification-message.warning .notification-progress {
  background: var(--warning-color);
}

/* 暗色模式 */
[data-theme="dark"] .notification-message.info {
  background: rgba(33, 150, 243, 0.15);
  border-color: rgba(33, 150, 243, 0.25);
}

[data-theme="dark"] .notification-message.success {
  background: rgba(76, 175, 80, 0.15);
  border-color: rgba(76, 175, 80, 0.25);
}

[data-theme="dark"] .notification-message.error {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.25);
}

[data-theme="dark"] .notification-message.warning {
  background: rgba(255, 152, 0, 0.15);
  border-color: rgba(255, 152, 0, 0.25);
}

[data-theme="dark"] .notification-message .notification-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 响应式 */
@media (max-width: 480px) {
  .notification-area {
    left: 12px;
    right: 12px;
    top: 12px;
    max-width: none;
  }

  .notification-message {
    padding: 12px 14px;
  }
}

/* 用户面板 */
.user-panel {
  display: flex;
  align-items: center;
  padding: 20px;
}

.user-avatar {
  font-size: 40px;
  margin-right: 15px;
  color: var(--primary-color);
}

.user-info h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.user-info div {
  font-size: 14px;
  color: var(--text-light);
}

/* 统计卡片 */
.statistics-card .stat-title {
  text-align: center;
  margin-bottom: 20px;
  font-size: 18px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
}

.stat-value {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-color);
}

/* 论坛指南 */
.guidelines-list {
  list-style: none;
}

.guidelines-list li {
  display: flex;
  margin-bottom: 15px;
}

.guidelines-list i {
  color: var(--success-color);
  font-size: 18px;
  margin-right: 10px;
  margin-top: 3px;
}

.guidelines-list div {
  font-size: 14px;
  color: var(--text-light);
}

/* 通知 */
.notification {
  background: var(--primary-light);
  padding: 15px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  font-size: 14px;
  color: var(--primary-color);
  line-height: 1.5;
}

.notification i {
  margin-right: 8px;
  font-size: 18px;
}

/* 图片上传区域 */
.image-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.image-upload-area:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.image-upload-area.dragover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.image-upload-area i {
  font-size: 48px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.image-upload-area p {
  font-size: 16px;
  color: var(--text-color);
  margin-bottom: 5px;
}

.image-upload-area small {
  font-size: 12px;
  color: var(--text-light);
}

/* 图片预览区域 */
.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.image-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.remove-image:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Markdown编辑器样式 */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.editor-mode-switch {
  display: flex;
  gap: 5px;
}

.mode-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  background: var(--background-card);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

.mode-btn:hover {
  background: var(--background-light);
}

.mode-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.editor-container {
  position: relative;
  min-height: 150px;
}

.editor-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: var(--transition);
  background: var(--background-card);
  color: var(--text-color);
}

.editor-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.1);
  /* 使用CSS变量替代硬编码颜色 */
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.markdown-preview {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--background-card);
  overflow-y: auto;
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

.markdown-preview p {
  margin-bottom: 1em;
}

.markdown-preview code {
  background: var(--code-bg);
  padding: 2px 4px;
  border-radius: 0;
  font-family: 'Courier New', monospace;
  color: var(--code-text);
}

.markdown-preview pre {
  background: var(--code-bg);
  padding: 10px;
  border-radius: 0;
  overflow-x: auto;
  border: 1px solid var(--code-border);
}

.markdown-preview blockquote {
  border-left: 3px solid var(--border-color);
  padding-left: 10px;
  margin-left: 0;
  color: var(--text-light);
}

.editor-help {
  margin-top: 8px;
  color: var(--text-light);
  font-size: 12px;
}

/* 文本文件上传区域 */
.text-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.text-upload-area:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.text-upload-area i {
  font-size: 36px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.text-upload-area p {
  font-size: 14px;
  color: var(--text-color);
  margin-bottom: 5px;
}

.text-upload-area small {
  font-size: 12px;
  color: var(--text-light);
}

.text-upload-area.disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
  background: var(--background-light);
  border-color: var(--border-color);
}

.text-upload-area.disabled:hover {
  border-color: var(--border-color);
  background: var(--background-light);
}

.text-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 10px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.text-file-info i {
  color: var(--primary-color);
}

.remove-text-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 5px;
  border-radius: 0;
}

.remove-text-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--error-color);
}

/* 帖子列表 */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--primary-color);
}

.clickable-avatar {
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.clickable-avatar:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
  border-color: var(--secondary-color);
  box-shadow: 0 2px 6px rgba(43, 108, 176, 0.3);
}

.anonymous-avatar {
  background: var(--border-color);
  color: var(--text-light);
  cursor: default;
}

.user-details h3 {
  font-size: 16px;
  margin-bottom: 3px;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-name-row h3 {
  margin-bottom: 0;
  margin-right: 5px;
}

.class-info {
  font-size: 13px;
  color: var(--text-light);
}

.post-time {
  font-size: 13px;
  color: var(--text-light);
}

.post-content {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  line-height: 1.7;
  font-size: 15px;
}

.tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  margin-right: 8px;
  margin-bottom: 10px;
}

.anonymous-tag {
  background: var(--background-hover);
  color: var(--text-light);
}

/* 帖子页脚 */
.post-footer {
  padding: 15px 0;
}

.action-buttons {
  display: flex;
  /* 移动端关键：这一行有 5 个按钮且原本不换行，flex 子项又默认 min-width:auto
     不肯收缩 → 整行最小宽度把 .post 卡片、进而把 grid 轨道撑破，
     真机上表现为"操作栏被挤出屏幕"。允许换行 + 放宽横向间距即可自适应。 */
  flex-wrap: wrap;
  gap: 8px 20px;
}

.action-btn {
  display: flex;
  align-items: center;
  min-width: 0; /* 允许窄屏收缩，避免 min-content 撑破父容器 */
  gap: 6px;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: var(--transition-fast);
}

.action-btn:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.action-btn.active {
  color: var(--error-color);
}

.action-btn.active i {
  color: var(--error-color);
}

.action-btn.processing {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.action-btn i {
  font-size: 16px;
}

/* 删除按钮特定样式 */
.action-btn.delete-btn {
  color: var(--error-color);
}

.action-btn.delete-btn:hover {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error-color);
}

/* 收藏按钮特定样式 */
.action-btn.favorite-btn {
  color: var(--text-light);
}

.action-btn.favorite-btn:hover {
  background: rgba(255, 160, 0, 0.1);
  color: var(--favorite-color);
}

.action-btn.favorite-btn.active {
  background: var(--favorite-color);
  color: white;
}

.action-btn.favorite-btn.active i {
  color: white;
}

/* 点踩按钮特定样式 */
.action-btn.dislike-btn {
  color: var(--text-light);
}

.action-btn.dislike-btn:hover {
  background: rgba(233, 30, 99, 0.08);
  color: var(--dislike-color);
}

.action-btn.dislike-btn.active {
  background: var(--dislike-color);
  color: white;
}

.action-btn.dislike-btn.active i {
  color: white;
}

/* 评论部分 */
.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 15px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.comments-header h4 {
  font-size: 16px;
  color: var(--text-color);
}

.add-comment-btn {
  font-size: 14px;
  color: var(--primary-color);
  cursor: pointer;
  transition: var(--transition);
}

.add-comment-btn:hover {
  text-decoration: underline;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.comment {
  background: var(--background-light);
  padding: 12px 15px;
  border-radius: var(--radius-md);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comment-user {
  font-weight: 500;
  font-size: 14px;
}

.comment-time {
  font-size: 12px;
  color: var(--text-light);
}

.comment-content {
  font-size: 14px;
}

.view-all-comments {
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  transition: var(--transition);
}

.view-all-comments:hover {
  color: var(--primary-color);
  background: var(--background-light);
  border-radius: var(--radius-xs);
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 25px;
  position: relative;
  animation: modalFadeIn 0.3s ease;
}

/* 弹窗内部布局 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3,
.modal-header h2 {
  margin: 0;
  color: var(--text-color);
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

/* categories.html 弹窗底部操作区 */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

/* =============================================
   全局按钮系统（底座 + 语义变体）
   ============================================= */

/* 底座 — 所有按钮共用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--btn-padding-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* 尺寸变体 */
.btn-sm {
  padding: var(--btn-padding-sm);
  font-size: var(--btn-font-size-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--btn-padding-lg);
  font-size: 15px;
  border-radius: var(--radius-lg);
}

/* 主要按钮 */
.btn-primary {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-dark);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(43, 108, 176, 0.3);
}

/* 次要/取消按钮 */
.btn-cancel,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--btn-padding-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
  background: var(--background-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-cancel:hover,
.btn-secondary:hover {
  background: var(--border-color);
}

/* 成功/确认按钮 */
.btn-success,
.btn-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--btn-padding-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
  background: var(--success-color);
  color: white;
  border: 1px solid var(--success-dark);
}

.btn-success:hover,
.btn-confirm:hover {
  background: var(--success-dark);
}

/* 危险按钮 */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--btn-padding-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
  background: var(--error-color);
  color: white;
  border: 1px solid var(--error-dark);
}

.btn-danger:hover {
  background: var(--error-dark);
}

/* 警告按钮 */
.btn-warning {
  background: var(--warning-color);
  color: white;
  border: 1px solid var(--warning-dark);
}

.btn-warning:hover {
  background: var(--warning-dark);
}

/* 信息按钮 */
.btn-info {
  background: var(--info-color);
  color: white;
  border: 1px solid var(--info-dark);
}

.btn-info:hover {
  background: var(--info-dark);
}

/* 轮廓按钮 */
.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

/* 链接式按钮 */
.btn-link {
  background: transparent;
  color: var(--primary-color);
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

/* 弹窗关闭按钮（用于 categories.html / category.html 的 <button class="modal-close">） */
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  line-height: 1;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--error-color);
}

/* 弹窗操作按钮（向后兼容） */
.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--btn-padding-md);
  border-radius: var(--radius-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.modal-btn.cancel {
  background: var(--background-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.modal-btn.cancel:hover {
  background: var(--border-color);
}

.modal-btn.confirm {
  background: var(--primary-color);
  color: white;
}

.modal-btn.confirm:hover {
  background: var(--primary-dark);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 弹窗关闭按钮（用于 button 元素） */
.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  color: var(--text-light);
}

.close-modal:hover {
  color: var(--error-color);
}

.form-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
}

/* 用户信息显示 */
.user-info-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: var(--background-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.user-info-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--primary-color);
}

.user-info-details {
  flex: 1;
}

.user-info-name {
  font-weight: 600;
  font-size: 16px;
}

.user-info-class {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

.user-info-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
  font-size: 16px;
}

.loading i {
  margin-right: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 16px;
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }
  
  .form-row .form-group {
    min-width: 100%;
  }
}

/* 用户信息卡片样式优化 */
.user-info-card {
  padding: 12px;
  border-radius: var(--radius-md);
}

.user-info-details {
  overflow: hidden;
}

.user-info-class {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 图片上传样式 */
.image-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--background-light);
}

.image-upload-area:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.image-upload-area.dragover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.image-upload-area.disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
  background: var(--background-light);
  border-color: var(--border-color);
}

.image-upload-area.disabled:hover {
  border-color: var(--border-color);
  background: var(--background-light);
}

.image-upload-area i {
  font-size: 40px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.image-upload-area p {
  font-size: 16px;
  color: var(--text-color);
  margin-bottom: 5px;
}

.image-upload-area small {
  color: var(--text-light);
  font-size: 13px;
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-item .remove-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* 图片在帖子中的显示 */
.post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.post-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.post-image:hover {
  transform: scale(1.05);
}

/* 图片预览模态框 */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.image-modal-content {
  max-width: 90%;
  max-height: 90%;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* 上传状态指示器 */
.upload-status {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 5px;
}

.upload-status.error {
  color: var(--error-color);
}

.upload-status.success {
  color: var(--success-color);
}/* 新帖子卡片样�?*/
.post-form-simple {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
}

.new-post-card {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.new-post-avatar {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-color);
  flex-shrink: 0;
}

.new-post-content {
  flex: 1;
}

.new-post-placeholder {
  padding: 15px;
  border: 2px dashed var(--border-color);
  border-radius: 0;
  margin-bottom: 15px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  background: var(--background-light);
}

.new-post-placeholder:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  color: var(--primary-color);
}

.new-post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* 移动端：按钮 + 长提示文字挤在一行会把按钮压扁，允许换行 */
  flex-wrap: wrap;
  gap: 10px 15px;
}

.new-post-btn {
  padding: 10px 25px;
  background: var(--primary-color);
  color: var(--button-text);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  /* 移动端关键：这个按钮是个 flex 容器且默认 min-width:auto，被压缩时会缩到
     单字宽度，中文标签就变成"一个字一行"的竖排。禁止压缩 + 禁止折行，
     实在放不下时由父级 flex-wrap 换行。 */
  flex-shrink: 0;
  white-space: nowrap;
}

.new-post-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.new-post-hint {
  color: var(--text-light);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  /* 允许收缩，把空间让给按钮，避免按钮被压成竖排 */
  flex: 1 1 auto;
  min-width: 0;
}

.new-post-hint i {
  color: var(--primary-color);
}

/* Markdown图片样式 */
.markdown-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 10px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

/* 帖子内容中的Markdown样式 */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  color: var(--text-color);
}

.post-content h1 {
  font-size: 1.6em;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3em;
}

.post-content h2 {
  font-size: 1.4em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

.post-content h3 {
  font-size: 1.2em;
}

.post-content p {
  margin-bottom: 1em;
  line-height: 1.6;
}

.post-content code {
  background: var(--inline-code-bg);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--code-text);
  border: 1px solid var(--code-border);
}

.post-content pre {
  background: var(--code-bg);
  padding: 15px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--code-border);
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 15px;
  margin-left: 0;
  color: var(--text-light);
  font-style: italic;
}

.post-content ul,
.post-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.post-content li {
  margin-bottom: 0.5em;
}

.post-content a {
  color: var(--primary-color);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.post-content th {
  background: var(--primary-light);
  font-weight: bold;
}

/* ==================== 优化的Markdown样式 ==================== */

/* 段落优化 */
.md-paragraph {
  margin-bottom: 1.2em;
  line-height: 1.7;
  text-align: justify;
  word-break: break-word;
}

/* 标题优化 */
.md-heading {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  color: var(--text-color);
  font-weight: 600;
  line-height: 1.3;
}

.post-content h1.md-heading {
  font-size: 1.8em;
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 0.4em;
  margin-top: 1em;
}

.post-content h2.md-heading {
  font-size: 1.5em;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3em;
}

.post-content h3.md-heading {
  font-size: 1.3em;
  color: var(--secondary-color);
}

.post-content h4.md-heading {
  font-size: 1.1em;
  color: var(--text-light);
}

.post-content h5.md-heading,
.post-content h6.md-heading {
  font-size: 1em;
  color: var(--text-light);
}

/* 粗体优化 */
.md-bold {
  font-weight: 700;
  color: var(--text-color);
}

/* 斜体优化 */
.md-italic {
  font-style: italic;
  color: var(--text-color);
}

/* 删除线优化 */
.md-strikethrough {
  text-decoration: line-through;
  color: var(--text-light);
  opacity: 0.8;
}

/* 链接优化 */
.md-link {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary-color);
  transition: var(--transition-fast);
}

.md-link:hover {
  color: var(--secondary-color);
  border-bottom: 1px solid var(--secondary-color);
  text-decoration: none;
}

/* 图片优化 */
.md-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1em 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: block;
}

/* 引用块优化 */
.md-blockquote {
  border-left: 4px solid var(--primary-color);
  padding: 1em 1.5em;
  margin: 1.5em 0;
  background: var(--primary-light);
  border-radius: 0;
  font-style: normal;
  color: var(--text-color);
}

.md-blockquote p {
  margin: 0;
}

/* 列表优化 */
.md-unordered-list,
.md-ordered-list {
  margin: 1.2em 0;
  padding-left: 2.2em;
}

.md-list-item {
  margin-bottom: 0.6em;
  line-height: 1.6;
}

.md-unordered-list .md-list-item {
  list-style-type: disc;
}

.md-ordered-list .md-list-item {
  list-style-type: decimal;
}

/* 水平线优化 */
.md-hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--border-color), transparent);
  margin: 2.5em 0;
}

/* 表格优化 */
.md-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.md-table th {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border: none;
}

.md-table td {
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border-color);
}

.md-table tr:nth-child(even) {
  background: var(--background-light);
}

.md-table tr:hover {
  background: var(--primary-light);
}

/* 代码块优化 */
.md-code-block {
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  background: var(--code-bg);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--code-header-bg);
  border-bottom: 1px solid var(--code-border);
}

.code-language {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: #ccc;
  text-transform: uppercase;
  font-weight: 600;
}

.copy-code-btn {
  background: #007acc;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.copy-code-btn:hover {
  background: #005a9e;
}

.copy-code-btn.copied {
  background: var(--success-color);
}

.md-pre {
  margin: 0;
  padding: 16px;
  background: #1e1e1e;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
}

.md-pre code {
  background: none;
  padding: 0;
  color: #d4d4d4;
  font-family: inherit;
  font-size: inherit;
}

/* 行内代码优化 */
.inline-code {
  background: var(--inline-code-bg);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--code-text);
  border: 1px solid var(--code-border);
  font-weight: 500;
}

/* 语法高亮颜色 */
.keyword {
  color: #569cd6;
}

.builtin {
  color: #4ec9b0;
}

.string {
  color: #ce9178;
}

.comment {
  color: #6a9955;
  font-style: italic;
}

.number {
  color: #b5cea8;
}

.tag {
  color: #569cd6;
}

.attribute {
  color: #9cdcfe;
}

.value {
  color: #ce9178;
}

.selector {
  color: #d7ba7d;
}

.property {
  color: #9cdcfe;
}

.important {
  color: #ff6b6b;
  font-weight: bold;
}

/* 代码行号 */
.md-pre {
  counter-reset: line;
}

.md-pre code {
  display: block;
}

.md-pre code .line {
  display: block;
  position: relative;
  padding-left: 3.5em;
}

.md-pre code .line::before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: 0;
  width: 3em;
  text-align: right;
  padding-right: 0.5em;
  color: #6a9955;
  opacity: 0.5;
  -webkit-user-select: none;
  user-select: none;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .md-paragraph {
    font-size: 15px;
    line-height: 1.6;
  }
  
  .post-content h1.md-heading {
    font-size: 1.5em;
  }
  
  .post-content h2.md-heading {
    font-size: 1.3em;
  }
  
  .post-content h3.md-heading {
    font-size: 1.1em;
  }
  
  .md-table {
    font-size: 14px;
  }
  
  .md-table th,
  .md-table td {
    padding: 8px 12px;
  }
  
  .md-pre {
    font-size: 13px;
    padding: 12px;
  }
  
  .code-header {
    padding: 6px 12px;
  }
}

/* ==================== 增强表格样式 ==================== */

/* 表格容器 */
.table-container {
  margin: 1.5em 0;
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* 增强表格 */
.enhanced-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--background-card);
}

.enhanced-table th {
  background: #2b6cb0;
  color: white;
  font-weight: 600;
  padding: 14px 16px;
  border: none;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.enhanced-table td {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.enhanced-table tr:nth-child(even) {
  background: #f8f9fa;
}

.enhanced-table tr:hover {
  background: #e3f2fd;
}

.enhanced-table tr:hover td {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 表格对齐样式 */
.enhanced-table th[style*="center"],
.enhanced-table td[style*="center"] {
  text-align: center;
}

.enhanced-table th[style*="right"],
.enhanced-table td[style*="right"] {
  text-align: right;
}

.enhanced-table th[style*="left"],
.enhanced-table td[style*="left"] {
  text-align: left;
}

/* 表格中的代码 */
.enhanced-table td .inline-code {
  font-size: 0.85em;
  padding: 1px 6px;
  background: #f1f3f5;
  border-radius: 0;
  border: 1px solid #dee2e6;
}

/* 表格中的数学公式 */
.enhanced-table td .math-inline {
  font-size: 0.9em;
  padding: 0 3px;
  background: rgba(214, 51, 132, 0.08);
}

/* 表格响应式 */
@media (max-width: 768px) {
  .table-container {
    margin: 1em 0;
    border-radius: var(--radius-sm);
  }
  
  .enhanced-table th,
  .enhanced-table td {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .enhanced-table th {
    position: static;
  }
}

/* ==================== 数学公式样式 ==================== */

/* 行内数学公式 */
.math-inline {
  display: inline-block;
  font-size: 1em;
  line-height: 1.2;
  color: #d63384;
  background: rgba(214, 51, 132, 0.05);
  padding: 0 4px;
  border-radius: 0;
  margin: 0 2px;
  vertical-align: middle;
}

/* 块级数学公式 */
.math-block {
  display: block;
  text-align: center;
  margin: 1.5em 0;
  padding: 1em;
  background: #f8f9fa;
  border-radius: var(--radius-md);
  border-left: 4px solid #2b6cb0;
  overflow-x: auto;
  overflow-y: hidden;
}

.math-block .katex-display {
  margin: 0.5em 0;
  padding: 0.5em;
}

/* KaTeX公式样式优化 */
.katex {
  font-size: 1.1em;
  font-family: 'KaTeX_Main', 'Times New Roman', serif;
}

.katex-display {
  margin: 1em 0;
}

.katex-display > .katex {
  display: inline-block;
  text-align: center;
  max-width: 100%;
}

/* 数学公式中的文本 */
.katex .mord {
  color: #333;
}

.katex .mbin {
  color: #2b6cb0;
}

.katex .mrel {
  color: #d63384;
}

.katex .mopen,
.katex .mclose {
  color: #20c997;
}

.katex .mord.text {
  color: #6c757d;
  font-style: italic;
}

/* 数学公式错误状态 */
.math-error {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.05);
  border: 1px dashed #dc3545;
  padding: 0.5em;
  border-radius: var(--radius-xs);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

/* 数学公式容器响应式 */
@media (max-width: 768px) {
  .math-block {
    padding: 0.8em;
    margin: 1em 0;
  }
  
  .katex {
    font-size: 1em;
  }
  
  .math-inline {
    font-size: 0.95em;
    padding: 0 3px;
  }
}

/* 数学公式复制按钮 */
.math-block {
  position: relative;
}

.math-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(43, 108, 176, 0.1);
  color: #2b6cb0;
  border: 1px solid rgba(43, 108, 176, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition-fast);
}

.math-block:hover .math-copy-btn {
  opacity: 1;
}

.math-copy-btn:hover {
  background: #2b6cb0;
  color: white;
}

.math-copy-btn.copied {
  background: var(--success-color);
  color: white;
  border-color: #4caf50;
}

/* ==================== 增强的Markdown格式样式 ==================== */

/* 粗斜体组合 */
.md-bold .md-italic,
.md-italic .md-bold {
  font-weight: 700;
  font-style: italic;
}

/* 下划线 */
.md-underline {
  text-decoration: underline;
  text-decoration-color: #2b6cb0;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* 高亮文本 */
.md-highlight {
  background: #ffd166;
  padding: 0 4px;
  border-radius: 0;
  box-shadow: 0 1px 2px rgba(255, 209, 102, 0.3);
}

/* 嵌套列表 */
.md-nested-list {
  margin-left: 1.5em;
  border-left: 2px solid #e9ecef;
  padding-left: 1em;
}

.md-list-indent-1 { margin-left: 1.5em; }
.md-list-indent-2 { margin-left: 3em; }
.md-list-indent-3 { margin-left: 4.5em; }
.md-list-indent-4 { margin-left: 6em; }

/* 增强的引用块 */
.md-blockquote {
  background: #f8f9fa;
  border-left: 4px solid #2b6cb0;
  padding: 1.2em 1.5em;
  margin: 1.5em 0;
  border-radius: 0;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.md-blockquote::before {
  content: '"';
  font-size: 3em;
  color: #2b6cb0;
  opacity: 0.2;
  position: absolute;
  top: -10px;
  left: 10px;
  font-family: Georgia, serif;
}

.md-blockquote p {
  margin: 0;
  font-style: italic;
  color: #495057;
  line-height: 1.6;
}

/* 脚注 */
.md-footnote-ref {
  font-size: 0.8em;
  vertical-align: super;
  line-height: 0;
}

.md-footnote-ref a {
  color: #2b6cb0;
  text-decoration: none;
  padding: 0 2px;
  background: rgba(43, 108, 176, 0.1);
  border-radius: 0;
}

.md-footnote-ref a:hover {
  background: rgba(43, 108, 176, 0.2);
  text-decoration: underline;
}

.md-footnotes {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid #dee2e6;
  font-size: 0.9em;
  color: #6c757d;
}

.md-footnotes ol {
  padding-left: 1.5em;
}

.md-footnotes li {
  margin-bottom: 0.5em;
  line-height: 1.5;
}

/* 增强的水平线 */
.md-hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, #2b6cb0, transparent);
  margin: 2em 0;
  position: relative;
}

.md-hr::before {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--background-card);
  padding: 0 10px;
  color: var(--primary-color);
  font-size: 1.2em;
}

/* 增强的链接悬停效果 */
.md-link {
  color: #2b6cb0;
  text-decoration: none;
  border-bottom: 1px dashed rgba(43, 108, 176, 0.3);
  transition: var(--transition-fast);
  position: relative;
}

.md-link:hover {
  color: #1e4e79;
  border-bottom: 1px solid #1e4e79;
  background: rgba(43, 108, 176, 0.05);
  padding: 0 2px;
  margin: 0 -2px;
  border-radius: 0;
}

.md-link::after {
  content: '↗';
  font-size: 0.8em;
  margin-left: 2px;
  opacity: 0.7;
}

/* 增强的图片样式 */
.md-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: block;
  margin: 1.5em auto;
}

.md-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 增强的段落 */
.md-paragraph {
  line-height: 1.8;
  margin-bottom: 1.2em;
  text-align: justify;
  hyphens: auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .md-blockquote {
    padding: 1em;
    margin: 1em 0;
  }
  
  .md-nested-list {
    margin-left: 1em;
    padding-left: 0.5em;
  }
  
  .md-list-indent-1 { margin-left: 1em; }
  .md-list-indent-2 { margin-left: 2em; }
  .md-list-indent-3 { margin-left: 3em; }
  .md-list-indent-4 { margin-left: 4em; }
  
  .md-hr {
    margin: 1.5em 0;
  }
  
  .md-image {
    margin: 1em auto;
  }
}

/* ==================== 增强的语法高亮样式 ==================== */

/* PHP语法高亮 */
.php-tag {
  color: #8892bf;
  font-weight: bold;
}

.variable {
  color: #e36209;
}

/* SQL语法高亮 */
.sql-keyword {
  color: #00758f;
  font-weight: bold;
}

/* Bash/Shell语法高亮 */
.shebang {
  color: #6a9955;
  font-style: italic;
}

.command {
  color: #4ec9b0;
}

.parameter {
  color: #9cdcfe;
}

/* JSON语法高亮 */
.json-key {
  color: #9cdcfe;
}

.json-string {
  color: #ce9178;
}

.json-boolean {
  color: #569cd6;
}

.json-null {
  color: #569cd6;
  font-style: italic;
}

.json-number {
  color: #b5cea8;
}

/* TypeScript语法高亮 */
.ts-keyword {
  color: #c586c0;
}

.ts-type {
  color: #4ec9b0;
  font-style: italic;
}

/* YAML语法高亮 */
.yaml-key {
  color: #9cdcfe;
}

.yaml-string {
  color: #ce9178;
}

.yaml-boolean {
  color: #569cd6;
}

.yaml-number {
  color: #b5cea8;
}

/* Markdown语法高亮（用于代码块中的Markdown） */
.md-header {
  color: #569cd6;
}

.md-title {
  color: #dcdcaa;
}

.md-bold {
  color: #dcdcaa;
  font-weight: bold;
}

.md-italic {
  color: #dcdcaa;
  font-style: italic;
}

.md-code-block {
  color: #6a9955;
}

.md-inline-code {
  color: #ce9178;
  background: rgba(206, 145, 120, 0.1);
  padding: 1px 4px;
  border-radius: 0;
}

.md-link {
  color: #9cdcfe;
}

.md-list-marker {
  color: #d7ba7d;
}

.md-list-item {
  color: #dcdcaa;
}

/* 代码块行号增强 */
.md-pre code .line[data-line]::before {
  content: attr(data-line);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
}

/* 代码块滚动条样式 */
.md-pre::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.md-pre::-webkit-scrollbar-track {
  background: #252526;
  border-radius: var(--radius-xs);
}

.md-pre::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: var(--radius-xs);
}

.md-pre::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* 代码块复制按钮动画 */
.copy-code-btn {
  transition: var(--transition);
}

.copy-code-btn:active {
  transform: scale(0.95);
}

/* 代码块悬停效果 */
.md-code-block:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 行内代码悬停效果 */
.inline-code:hover {
  background: #e8e8e8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 表格增强样式 */
.md-table.enhanced-table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.md-table.enhanced-table th {
  background: #2b6cb0;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9em;
  letter-spacing: 0.5px;
}

.md-table.enhanced-table tr:nth-child(even) {
  background: rgba(43, 108, 176, 0.03);
}

.md-table.enhanced-table tr:hover {
  background: rgba(43, 108, 176, 0.08);
}

/* 引用块代码样式 */
.md-blockquote .inline-code {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(43, 108, 176, 0.3);
}

/* 列表中的代码样式 */
.md-list-item .inline-code {
  background: rgba(43, 108, 176, 0.05);
  border-color: rgba(43, 108, 176, 0.2);
}

/* 顶栏用户头像样式 */
.header-user-avatar {
  position: relative;
  cursor: pointer;
  margin-right: 10px;
}

.header-user-avatar i {
  font-size: 32px;
  color: white;
  transition: transform 0.3s ease;
}

.header-user-avatar .header-avatar-image {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
}

.header-user-avatar:hover .header-avatar-image {
  transform: scale(1.1);
}

.header-user-avatar:hover i {
  transform: scale(1.1);
}

/* 管理员头像特殊样式 */
.header-user-avatar.admin-avatar i {
  color: var(--primary-color);
}

.header-user-avatar.admin-avatar .header-avatar-image {
  border-color: var(--primary-color);
}

.header-user-avatar.admin-avatar:hover i {
  transform: scale(1.1);
}

.header-user-avatar.admin-avatar:hover .header-avatar-image {
  transform: scale(1.1);
}

.header-user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--background-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  margin-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 1000;
  border: 1px solid var(--border-color);
}

.header-user-avatar.active .header-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 保留悬停时的图标缩放效果 */
.header-user-avatar:hover i {
  transform: scale(1.1);
}

.header-user-info {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.header-user-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-color);
  margin-bottom: 4px;
}

.header-user-class {
  font-size: 13px;
  color: var(--text-light);
}

.header-user-level {
  margin-top: 8px;
}

.header-user-level .level-badge {
  font-size: 11px;
  padding: 4px 8px;
}

.header-user-menu {
  padding: 8px 0;
}

.header-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.header-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.header-menu-item:hover i {
  color: var(--primary-color);
}

.header-menu-item i {
  width: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--icon-color);
}

.header-menu-item.logout {
  color: var(--error-color) !important;
}

.header-menu-item.logout i {
  color: var(--error-color) !important;
}

.header-menu-item.logout:hover {
  background: rgba(244, 67, 54, 0.1);
  /* 使用CSS变量替代硬编码颜色 */
  background: color-mix(in srgb, var(--error-color) 10%, transparent);
  color: var(--error-color) !important;
}

.header-menu-item.logout:hover i {
  color: var(--error-color) !important;
}

.header-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .header-user-dropdown {
    position: fixed;
    top: 60px;
    right: 10px;
    left: 10px;
    min-width: auto;
  }
  
  .header-user-avatar {
    margin-right: 5px;
  }
  
  .header-user-avatar i {
    font-size: 28px;
  }
}

/* 等级系统样式 */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.level-badge:hover {
  transform: scale(1.05);
}

.level-badge i {
  font-size: 14px;
}

.level-number {
  font-weight: bold;
}

.level-title {
  font-weight: 500;
  opacity: 0.9;
}

.level-progress {
  background: var(--background-card);
  border-radius: var(--radius-md);
  padding: 15px;
  margin: 10px 0;
  border: 1px solid var(--border-color);
}

.level-progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.level-current {
  color: var(--primary-color);
}

.level-next {
  color: var(--text-light);
  font-size: 12px;
}

.level-max {
  color: var(--success-color);
  font-weight: bold;
}

.level-progress-bar {
  height: 8px;
  background: var(--background-light);
  border-radius: var(--radius-xs);
  overflow: hidden;
  margin-bottom: 8px;
}

.level-progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: var(--radius-xs);
  transition: width 0.3s ease;
}

.level-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

/* 帖子列表中的等级徽章 */
.post-meta .level-badge {
  font-size: 11px;
  padding: 3px 8px;
}

.post-meta .level-badge i {
  font-size: 12px;
}

/* 评论中的等级徽章 */
.comment-header .level-badge {
  font-size: 11px;
  padding: 3px 8px;
}

.comment-header .level-badge i {
  font-size: 12px;
}

/* 用户信息卡片中的等级 */
.user-level-info {
  margin: 15px 0;
}

.user-level-info .level-progress {
  margin: 10px 0 0 0;
}

/* 暗色主题适配 */
[data-theme="dark"] .level-badge {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .level-progress {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .level-progress-bar {
  background: #334155;
}

[data-theme="dark"] .level-progress-text {
  color: #94a3b8;
}

[data-theme="dark"] .level-next {
  color: #64748b;
}

/* 举报模态框 */
.report-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.report-modal-content {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.report-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.report-modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  color: var(--text-color);
}

.report-modal-header h3 i {
  color: var(--warning-color);
}

.report-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  line-height: 1;
}

.report-modal-close:hover {
  color: var(--error-color);
}

.report-modal-body {
  padding: 20px;
}

.report-reason-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.report-reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--background-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.report-reason-item:hover {
  background: var(--primary-light);
}

.report-reason-item input[type="radio"] {
  display: none;
}

.report-reason-item input[type="radio"]:checked + .reason-icon {
  transform: scale(1.2);
}

.report-reason-item input[type="radio"]:checked ~ .reason-text {
  color: var(--primary-color);
  font-weight: 600;
}

.report-reason-item:has(input[type="radio"]:checked) {
  background: var(--primary-light);
  border-color: var(--primary-color);
}

.reason-icon {
  font-size: 20px;
  transition: var(--transition);
}

.reason-text {
  font-size: 14px;
  color: var(--text-color);
}

.report-description {
  margin-top: 15px;
}

.report-description label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 8px;
}

.report-description textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  resize: vertical;
  background: var(--background-light);
  color: var(--text-color);
  transition: var(--transition);
}

.report-description textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--background-card);
}

.report-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
}

.report-btn-cancel {
  padding: 10px 20px;
  background: var(--background-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}

.report-btn-cancel:hover {
  background: var(--border-color);
}

.report-btn-submit {
  padding: 10px 20px;
  background: var(--warning-color);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.report-btn-submit:hover {
  background: #e68a00;
}

.report-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 举报按钮样式 */
.action-btn.report-btn {
  color: var(--text-light);
}

.action-btn.report-btn:hover {
  color: var(--warning-color);
}

/* 暗色主题适配 */
[data-theme="dark"] .report-modal-content {
  background: #1e293b;
}

[data-theme="dark"] .report-modal-header {
  border-color: #334155;
}

[data-theme="dark"] .report-reason-item {
  background: #334155;
}

[data-theme="dark"] .report-reason-item:hover {
  background: #3b4a5e;
}

[data-theme="dark"] .report-reason-item:has(input[type="radio"]:checked) {
  background: rgba(43, 108, 176, 0.2);
  border-color: var(--primary-color);
}

[data-theme="dark"] .report-description textarea {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .report-btn-cancel {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .report-modal-footer {
  border-color: #334155;
}

/* Header 暗色模式样式 */
[data-theme="dark"] .header-user-dropdown {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .header-user-info {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .header-user-name {
  color: #e2e8f0;
}

[data-theme="dark"] .header-user-class {
  color: #94a3b8;
}

[data-theme="dark"] .header-menu-item {
  color: #cbd5e1;
}

[data-theme="dark"] .header-menu-item:hover {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .header-menu-item i {
  color: #94a3b8;
}

[data-theme="dark"] .header-menu-item:hover i {
  color: #e2e8f0;
}

[data-theme="dark"] .header-menu-divider {
  background: #475569;
}

[data-theme="dark"] .header-menu-item.logout {
  color: #f87171;
}

[data-theme="dark"] .header-menu-item.logout i {
  color: #f87171;
}

[data-theme="dark"] .header-menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .header-user-avatar.admin-avatar i {
  color: #818cf8;
}

/* 收藏标签选择弹窗 */
.favorite-tag-modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.favorite-tag-modal-content {
  background: var(--background-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.favorite-tag-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.favorite-tag-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.favorite-tag-modal-header h3 i {
  color: var(--primary-color);
}

.favorite-tag-modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-tag-modal-close:hover {
  background: var(--background-light);
  color: var(--error-color);
}

.favorite-tag-modal-body {
  padding: 20px;
}

.favorite-tag-hint {
  font-size: 13px;
  color: var(--text-light);
  margin: 0 0 15px 0;
}

.tag-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--background-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 2px solid transparent;
}

.tag-select-item:hover {
  background: var(--primary-light);
}

.tag-select-item.selected {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.tag-select-item.no-tag {
  color: var(--text-light);
}

.tag-color-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.favorite-tag-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
}

/* btn-skip/btn-save-tag 已统一到全局按钮体系，此处仅保留语义定义 */
.btn-skip {
  background: var(--background-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: var(--btn-padding-md);
  border-radius: var(--radius-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-skip:hover {
  background: var(--border-color);
}

.btn-save-tag {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-dark);
  padding: var(--btn-padding-md);
  border-radius: var(--radius-md);
  font-size: var(--btn-font-size);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-save-tag:hover {
  background: var(--secondary-color);
}

/* 暗色模式弹窗 */
[data-theme="dark"] .favorite-tag-modal-content {
  background: #1e293b;
}

[data-theme="dark"] .favorite-tag-modal-header {
  border-color: #334155;
}

[data-theme="dark"] .favorite-tag-modal-close:hover {
  background: #334155;
}

[data-theme="dark"] .tag-select-item {
  background: #334155;
}

[data-theme="dark"] .tag-select-item:hover,
[data-theme="dark"] .tag-select-item.selected {
  background: rgba(43, 108, 176, 0.2);
}

[data-theme="dark"] .favorite-tag-modal-footer {
  border-color: #334155;
}

[data-theme="dark"] .btn-skip {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-skip:hover {
  background: #475569;
}

[data-theme="dark"] .header-user-avatar.admin-avatar .header-avatar-image {
  border-color: #818cf8;
}

/* 暗色模式搜索框 */
[data-theme="dark"] .search-box input {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .search-box input:focus {
  background: #1e293b;
  border-color: #2b6cb0;
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.2);
}

[data-theme="dark"] .search-box input::placeholder {
  color: #94a3b8;
}

[data-theme="dark"] .search-clear-btn:hover {
  background: #475569;
  color: #e2e8f0;
}

[data-theme="dark"] .search-results-info {
  background: rgba(43, 108, 176, 0.15);
}

[data-theme="dark"] .clear-search-btn {
  border-color: #2b6cb0;
  color: #818cf8;
}

[data-theme="dark"] .clear-search-btn:hover {
  background: #2b6cb0;
  color: white;
}

[data-theme="dark"] .sort-options {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .sort-label {
  color: #94a3b8;
}

[data-theme="dark"] .sort-btn {
  border-color: #334155;
  color: #94a3b8;
  background: transparent;
}

[data-theme="dark"] .sort-btn:hover {
  background: rgba(43, 108, 176, 0.15);
  border-color: #2b6cb0;
  color: #818cf8;
}

[data-theme="dark"] .sort-btn.active {
  background: #2b6cb0;
  border-color: #2b6cb0;
  color: white;
}

/* 搜索框响应式 */
@media (max-width: 900px) {
  .header-search {
    display: none;
  }

  .posts-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .posts-section-header .section-title {
    margin-bottom: 10px;
  }
}

/* 搜索无结果样式 */
.empty-state.search-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state.search-empty i {
  font-size: 48px;
  color: var(--border-color);
  margin-bottom: 20px;
}

.empty-state.search-empty p {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state.search-empty .empty-hint {
  font-size: 14px;
  color: var(--text-light);
  opacity: 0.7;
}

/* 搜索历史暗色模式 */
[data-theme="dark"] .search-history {
  background: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .search-history-header {
  border-color: #334155;
}

[data-theme="dark"] .clear-history-btn:hover {
  background: #334155;
}

[data-theme="dark"] .history-item:hover {
  background: #334155;
}

[data-theme="dark"] .history-item-delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* MathJax 公式样式 */
mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 4px 0;
}

/* 行内公式 */
mjx-container[display="false"] {
  display: inline-block !important;
  vertical-align: middle;
}

/* 块级公式居中显示 */
mjx-container[display="true"] {
  display: block !important;
  text-align: center;
  margin: 16px auto;
  overflow-x: auto;
  overflow-y: hidden;
}

/* SVG 公式样式 */
mjx-container svg {
  max-width: 100%;
  height: auto;
}

/* 公式容器滚动条样式 */
.post-content mjx-container,
.post-detail-content mjx-container,
.comment-content mjx-container,
.preview-area mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
}

/* 独立公式块容器 */
.post-content p:has(mjx-container[display="true"]),
.post-detail-content p:has(mjx-container[display="true"]) {
  text-align: center;
  overflow-x: auto;
  padding: 8px 0;
}

/* 暗色模式下的公式样式 */
[data-theme="dark"] mjx-container {
  color: #e2e8f0;
}

[data-theme="dark"] mjx-container svg {
  fill: #e2e8f0;
}

/* ==================== 公告样式 ==================== */

/* 顶部横幅公告 */
.announcement-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  margin: 0;
  border-bottom: 1px solid;
  position: relative;
  z-index: 10;
}

.announcement-banner.type-info {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.announcement-banner.type-success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.announcement-banner.type-warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.announcement-banner.type-danger {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

.announcement-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.announcement-banner-content > i {
  font-size: 18px;
}

.announcement-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
}

.announcement-banner-text #announcement-banner-title {
  font-weight: 600;
}

.announcement-banner-text #announcement-banner-message {
  opacity: 0.9;
}

.announcement-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.announcement-close:hover {
  opacity: 1;
}

/* 公告列表区域 */
.announcements-list-container {
  margin-bottom: 20px;
}

.announcements-section-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.announcements-section-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--primary-color);
  margin: 0;
}

.announcement-item {
  background: white;
  border-radius: 0;
  padding: 15px;
  margin-bottom: 10px;
  border-left: 4px solid;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.announcement-item:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.announcement-item.type-info {
  border-left-color: #3b82f6;
}

.announcement-item.type-success {
  border-left-color: #10b981;
}

.announcement-item.type-warning {
  border-left-color: #f59e0b;
}

.announcement-item.type-danger {
  border-left-color: #ef4444;
}

.announcement-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.announcement-item-header > i {
  color: var(--primary-color);
  font-size: 14px;
}

.announcement-item-title {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.announcement-item-header .pinned {
  color: #f59e0b;
  font-size: 12px;
}

.announcement-item-content {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.announcement-item-time {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 公告弹窗 */
.announcement-popup-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.announcement-popup-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.announcement-popup-content.type-info .announcement-popup-header {
  background: #3b82f6;
}

.announcement-popup-content.type-success .announcement-popup-header {
  background: #10b981;
}

.announcement-popup-content.type-warning .announcement-popup-header {
  background: #f59e0b;
}

.announcement-popup-content.type-danger .announcement-popup-header {
  background: #ef4444;
}

.announcement-popup-header {
  padding: 20px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.announcement-popup-header h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.announcement-popup-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  opacity: 0.8;
  transition: opacity 0.2s;
  font-size: 18px;
}

.announcement-popup-close:hover {
  opacity: 1;
}

.announcement-popup-body {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.announcement-popup-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.dont-show-again {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* 深色模式 */
[data-theme="dark"] .announcement-banner.type-info {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #bfdbfe;
}

[data-theme="dark"] .announcement-banner.type-success {
  background: #14532d;
  border-color: #22c55e;
  color: #bbf7d0;
}

[data-theme="dark"] .announcement-banner.type-warning {
  background: #78350f;
  border-color: #f59e0b;
  color: #fde68a;
}

[data-theme="dark"] .announcement-banner.type-danger {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fecaca;
}

[data-theme="dark"] .announcement-item {
  background: var(--card-bg);
}

[data-theme="dark"] .announcement-popup-content {
  background: var(--card-bg);
}

[data-theme="dark"] .announcement-popup-body {
  color: var(--text-primary);
}

[data-theme="dark"] .announcement-popup-footer {
  border-color: var(--border-color);
}

/* 响应式 */
@media (max-width: 768px) {
  .announcement-banner {
    padding: 10px 15px;
  }

  .announcement-banner-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .announcement-item {
    padding: 12px;
  }

  .announcement-popup-content {
    width: 95%;
    max-height: 85vh;
  }
}

/* ==================== 栏目导航栏 ==================== */
.category-nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 12px;
}

.category-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--background-light);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.category-nav-item:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.category-nav-item.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  font-weight: 500;
}

.category-count {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0;
  padding: 0 6px;
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}

.category-nav-item:not(.active) .category-count {
  background: var(--border-color);
  color: var(--text-light);
}

.no-categories {
  padding: 12px 0;
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
}

/* ==================== 侧边栏栏目卡片 ==================== */
.category-sidebar-card {
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.category-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.category-sidebar-header .section-title {
  margin-bottom: 0;
  font-size: 15px;
}

.category-sidebar-apply-btn {
  background: var(--primary-light);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.category-sidebar-apply-btn:hover {
  background: var(--primary-color);
  color: white;
}

.category-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}

.category-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-color);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
}

.category-sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.category-sidebar-item span:first-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-sidebar-count {
  font-size: 11px;
  color: var(--text-light);
  background: var(--background-light);
  border-radius: 0;
  padding: 1px 6px;
  flex-shrink: 0;
}

.category-sidebar-empty {
  padding: 12px 0;
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  font-style: italic;
}

.category-sidebar-loading {
  padding: 12px 0;
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
}

.category-sidebar-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.category-sidebar-all-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--primary-color);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
}

.category-sidebar-all-link:hover {
  background: var(--primary-light);
}

/* 申请栏目模态框 */
#applyCategoryModal .modal-body {
  padding: 0 20px 10px;
}

#applyCategoryModal .form-group {
  margin-bottom: 14px;
}

/* ==================== 栏目详情页样式 ==================== */

/* 栏目头部 */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.category-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.category-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--primary-light);
  color: var(--primary-color);
}

.category-details h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 4px;
}

.category-details p {
  font-size: 14px;
  color: var(--text-light);
}

.category-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--background-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-color);
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}

.back-home-btn:hover {
  background: var(--border-color);
  color: var(--text-color);
}

.apply-category-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary-color);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.apply-category-btn:hover {
  background: var(--secondary-color);
}

/* 排序选项 */
.sort-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sort-label {
  font-size: 14px;
  color: var(--text-light);
}

.sort-buttons {
  display: flex;
  gap: 8px;
}

.sort-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: 0;
  background: var(--background-card);
  color: var(--text-color);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.sort-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.sort-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 搜索结果提示 */
.search-results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--primary-color);
}

.clear-search-btn {
  padding: 4px 12px;
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--primary-color);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.clear-search-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* 侧边栏提示 */
.sidebar-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.5;
}

.sidebar-apply-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--primary-color);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.sidebar-apply-btn:hover {
  background: var(--secondary-color);
}

/* 帖子列表项 */
.post-item {
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.post-item:hover {
  background: var(--background-hover);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.post-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-user a {
  display: flex;
  align-items: center;
}

.post-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.anonymous-avatar {
  font-size: 32px;
  color: var(--text-light);
}

.post-user-info {
  display: flex;
  flex-direction: column;
}

.post-username {
  font-weight: 500;
  color: var(--text-color);
  font-size: 14px;
}

.post-meta {
  font-size: 12px;
  color: var(--text-light);
}

.post-time {
  font-size: 12px;
  color: var(--text-light);
}

.post-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
  margin-bottom: 12px;
  word-break: break-word;
}

.post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.post-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-md);
  cursor: pointer;
  object-fit: cover;
  transition: var(--transition);
}

.post-image:hover {
  opacity: 0.85;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--background-light);
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.post-action:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.post-action.liked {
  color: var(--error-color);
}

/* 图片预览模态框 */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
}

.image-modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: var(--radius-md);
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-state i {
  font-size: 48px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.btn-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.btn-link:hover {
  text-decoration: underline;
}

/* 加载更多 */
.load-more-container {
  text-align: center;
  padding: 20px 0;
}

.load-more-btn {
  padding: 10px 32px;
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--primary-color);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.load-more-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* 加载占位符 */
.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.loading-placeholder i {
  font-size: 24px;
  margin-bottom: 8px;
}

/* 错误占位符 */
.error-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--error-color);
}

/* 侧边栏栏目列表 */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-color);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
}

.category-list a:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.category-list a.active {
  background: var(--primary-light);
  color: var(--primary-color);
  font-weight: 500;
}

.cat-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-light);
  background: var(--background-light);
  border-radius: 0;
  padding: 1px 6px;
}

/* ==================== Emoji 面板样式 ==================== */
.emoji-picker-popup {
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
}
.emoji-item {
  width: 36px; height: 36px;
  border: none; background: transparent;
  cursor: pointer; font-size: 20px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
}
.emoji-item:hover { background: var(--background-hover); transform: scale(1.2); }

/* ===== 顶栏登录/注册按钮（主站页面通用） =====
   仅 edit-simple.css / error-styles.css 曾定义，主站页面缺失导致按钮样式丢失 */
#login-btn,
#register-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--background-light);
  color: var(--primary-color);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition, 0.3s);
  white-space: nowrap;
}

#login-btn:hover,
#register-btn:hover {
  background: var(--primary-color);
  color: white;
}

#login-btn:active,
#register-btn:active {
  transform: scale(0.97);
}

[data-theme="dark"] #login-btn,
[data-theme="dark"] #register-btn {
  background: #1e293b;
  color: #818cf8;
}

[data-theme="dark"] #login-btn:hover,
[data-theme="dark"] #register-btn:hover {
  background: #818cf8;
  color: #0f172a;
}

/* ==================== 移动端修复（2026-09-28） ====================
   两类只在窄屏暴露的问题：

   1) 横向溢出："元素被挤出屏幕"。
      根因是 grid / flex 子项默认 min-width:auto（= min-content），
      一旦内部有较宽内容（多个按钮排成一行、nowrap 文本等），子项就
      拒绝收缩，把 grid 轨道和卡片一起撑得比视口还宽。
      —— .main-content 的 1fr 已在上面改成 minmax(0,1fr)，
         这里再对布局容器统一放开收缩，作为兜底。

   2) 中文逐字折行：按钮等短标签被 flex 压到单字宽度时，
      会变成"一个字一行"的竖排（如"发布新帖子"）。
      word-break:keep-all 阻止 CJK 在词内断开，配合父级 flex-wrap 换行。 */

@media (max-width: 768px) {
  .container,
  .main-content,
  .main-content > *,
  .posts-section,
  .sidebar,
  .post,
  .post > *,
  .post-footer,
  .action-buttons,
  .new-post-card,
  .new-post-content,
  .category-nav-bar { min-width: 0; }

  button,
  .btn,
  .action-btn,
  .category-nav-item,
  .new-post-btn { word-break: keep-all; }
}

@media (max-width: 600px) {
  /* 窄屏收紧留白，换取更多内容宽度 */
  .posts-section { padding: 14px; }
  .post { padding: 16px; }
  .container { padding: 0 12px; }
  /* 触屏操作区稍微放大，避免误点 */
  .action-btn { padding: 8px 12px; }
}

/* ============================================================
   ✏️ [DSH 新增 2026-10-07] 职位标识（站长 / 站副长 …）
   显示在发帖、评论时作者名的旁边，由 User.title 字段驱动。
   前端渲染处：posts.js / post-detail.js
   ⚠ install.sh update 升级后会被覆盖，需重新追加本段。
   ============================================================ */
.user-title-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  vertical-align: middle;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #f87171, #dc2626);
  box-shadow: 0 1px 3px rgba(220, 38, 38, .3);
  white-space: nowrap;
  letter-spacing: .5px;
}

/* 暗色主题下略微提亮，保证对比度 */
[data-theme="dark"] .user-title-badge {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

/* 小屏紧凑一些 */
@media (max-width: 768px) {
  .user-title-badge {
    margin-left: 5px;
    padding: 0 6px;
    font-size: 11px;
    line-height: 16px;
    border-radius: 8px;
    box-shadow: none;
  }
}