:root {
  --primary: #ff4d6d;
  --primary-dark: #e8385a;
  --primary-light: #fff0f3;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2328;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #eef0f4;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 35, 40, 0.06);
  --admin-bg: #0f1420;
  --admin-card: #1a2234;
  --admin-text: #e6eaf2;
  --admin-accent: #4f8cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-size: 19px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.logo span { color: var(--text); }
.nav-search {
  flex: 1;
  max-width: 320px;
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 999px;
  padding: 0 14px;
  border: 1px solid transparent;
}
.nav-search:focus-within { border-color: var(--primary); background: #fff; }
.nav-search input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 14px;
  outline: none;
}
.nav-search svg { flex-shrink: 0; opacity: 0.5; margin-right: 6px; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}
.nav-user .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---------- 主布局 ---------- */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

/* 分类侧边栏 */
.sidebar { position: sticky; top: 76px; align-self: start; }
.sidebar-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.sidebar h4 {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding: 0 8px;
}
.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.cat-item:hover { background: var(--bg); color: var(--text); }
.cat-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.cat-item .count { font-size: 12px; opacity: 0.6; }

/* 内容区 */
.content { min-width: 0; }

.post-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.post-toolbar .sort-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
}
.sort-tabs button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
}
.sort-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tag-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* 帖子卡片 */
.post-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.post-card:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(31,35,40,0.1); }
.post-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}
.post-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.45;
}
.post-card .summary {
  font-size: 14px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.post-card .media-row { display: flex; gap: 8px; margin-bottom: 10px; }
.post-card .media-row img {
  width: 100px; height: 70px;
  object-fit: cover;
  border-radius: 8px;
}
.post-card .media-row .video-thumb {
  width: 100px; height: 70px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.post-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.post-card .tag {
  font-size: 12px;
  padding: 2px 8px;
  background: var(--bg);
  border-radius: 6px;
  color: var(--text-2);
}
.post-card .stats {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.post-card .stats span { display: flex; align-items: center; gap: 5px; }

/* 加载 / 空状态 */
.skeleton-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.sk-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f2f7 25%, #e6e9f0 50%, #f0f2f7 75%);
  background-size: 200% 100%;
  animation: sk 1.2s infinite;
  margin-bottom: 10px;
}
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 14px;
}
.empty .big { font-size: 40px; margin-bottom: 12px; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.page-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-2);
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 560px;
  margin: 0 auto;
}
.form-card.wide { max-width: 760px; }
.form-card h2 { font-size: 20px; margin-bottom: 20px; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field input[type="text"], .field input[type="password"], .field input[type="search"], .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-tip { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 16px; }
.form-tip a { color: var(--primary); font-weight: 600; }

/* 分类选择 */
.cat-select { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-select button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-2);
}
.cat-select button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* 图片上传 */
.img-upload-row { display: flex; gap: 8px; flex-wrap: wrap; }
.img-preview {
  width: 90px; height: 90px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-preview .del {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.upload-btn {
  width: 90px; height: 90px;
  border: 1px dashed var(--text-3);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}
.upload-btn svg { margin-bottom: 4px; }

/* 视频链接输入 */
.video-input-wrap { display: flex; gap: 8px; }
.video-input-wrap input { flex: 1; }

/* ---------- 帖子详情 ---------- */
.detail-wrap { max-width: 760px; margin: 0 auto; }
.detail-header { margin-bottom: 20px; }
.detail-header .back { font-size: 13px; color: var(--text-2); margin-bottom: 12px; display: inline-block; }
.detail-header h1 { font-size: 24px; line-height: 1.4; margin-bottom: 10px; }
.detail-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.author-chip { display: flex; align-items: center; gap: 8px; }
.author-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.detail-body {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.detail-body .content-text {
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-body .imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 16px; }
.detail-body .imgs img { width: 100%; border-radius: 10px; cursor: zoom-in; }
.video-box { margin-top: 16px; position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.video-jump {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-light);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #ffe0e6;
}
.video-jump .label { font-size: 13px; color: var(--primary); font-weight: 600; }
.video-jump a {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 6px 14px;
  border-radius: 8px;
}

.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.action-bar .btn { display: flex; align-items: center; gap: 6px; }
.action-bar .btn.liked { background: var(--primary-light); color: var(--primary); border: 1px solid #ffd6de; }
.action-bar .btn.favorited { background: #eef4ff; color: #3b82f6; border: 1px solid #d6e4ff; }

/* 评论区 */
.comments-section { margin-top: 20px; }
.comments-section h3 { font-size: 16px; margin-bottom: 14px; }
.comment-input { display: flex; gap: 10px; margin-bottom: 18px; }
.comment-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
}
.comment-input input:focus { border-color: var(--primary); }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-item .c-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.comment-item .c-name { font-weight: 600; }
.comment-item .c-time { color: var(--text-3); font-size: 12px; }
.comment-item .c-text { font-size: 14px; line-height: 1.7; word-break: break-word; }

/* ---------- 个人中心 ---------- */
.profile-wrap { max-width: 760px; margin: 0 auto; }
.profile-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.profile-card .avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
  flex-shrink: 0;
}
.profile-card .p-name { font-size: 18px; font-weight: 700; }
.profile-card .p-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.profile-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.profile-tabs button {
  border: none;
  background: var(--card);
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--shadow);
}
.profile-tabs button.active { background: var(--primary); color: #fff; }

/* ---------- 管理后台 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side {
  width: 220px;
  background: var(--admin-bg);
  color: var(--admin-text);
  flex-shrink: 0;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-logo { font-size: 17px; font-weight: 800; padding: 0 20px 18px; color: #fff; letter-spacing: 0.5px; }
.admin-logo span { color: var(--admin-accent); }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 14px;
  color: #9aa5bd;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}
.admin-nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.admin-nav-item.active { color: #fff; background: var(--admin-accent); font-weight: 600; }
.admin-main { flex: 1; background: var(--bg); padding: 24px; min-width: 0; }
.admin-main h2 { font-size: 20px; margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.admin-table-wrap { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.status-pill.normal { background: #e8f9ef; color: #16a34a; }
.status-pill.removed { background: #fee2e2; color: #dc2626; }
.status-pill.pending { background: #fef9c3; color: #ca8a04; }
.status-pill.approved { background: #e8f9ef; color: #16a34a; }
.status-pill.rejected { background: #f3f4f6; color: #6b7280; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-toolbar input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}
.admin-toolbar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  background: #fff;
}
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-bg);
}
.admin-login .form-card { background: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(17,24,39,0.92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(220,38,38,0.95); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.report-reasons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.report-reasons button {
  border: 1px solid var(--border);
  background: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
}
.report-reasons button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.modal textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  min-height: 70px;
  resize: vertical;
  outline: none;
  margin-bottom: 14px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 登录页 ---------- */
.auth-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .main { grid-template-columns: 1fr; padding-top: 12px; }
  .sidebar { position: static; margin-bottom: 4px; }
  .sidebar-card { padding: 10px; }
  .sidebar h4 { margin-bottom: 6px; }
  .cat-list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .cat-item { width: auto; white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  .cat-item .count { display: none; }
  .nav-search { max-width: none; }
  .nav-inner { gap: 10px; }
  .nav-user .label { display: none; }
  .detail-header h1 { font-size: 20px; }
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; display: flex; overflow-x: auto; padding: 0; }
  .admin-logo { display: none; }
  .admin-nav-item { width: auto; white-space: nowrap; padding: 12px 14px; }
  .admin-main { padding: 16px; }
}
