:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2533;
  --muted: #7a8499;
  --primary: #3b6cf6;
  --primary-d: #2f57d4;
  --danger: #e5484d;
  --border: #e6e9f2;
  --ok: #2fa36b;
  --shadow: 0 4px 18px rgba(31, 37, 51, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.topbar {
  background: #138101;
  border-bottom: 1px solid rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { font-weight: 700; font-size: 24px; flex-shrink: 0; }
.brand-link {
  display: flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none;
}
.brand-logo {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  vertical-align: middle;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.nav {
  display: flex; align-items: center;
  gap: 4px; flex-wrap: wrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
  flex: 1;
  min-width: 0;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.topbar-search input {
  flex: 1;
  min-width: 200px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  outline: none;
}
.btn-light {
  background: #fff;
  color: #138101;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.2;
  text-align: center;
}
.btn-search,
.btn-login,
.btn-register {
  min-width: 64px;
}
.btn-light:hover { background: #f0f7ef; }
.topbar-actions .user {
  color: #fff;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.topbar-actions .user .user-icon { color: #fff; flex-shrink: 0; }
.nav {
  display: flex; align-items: center;
  gap: 4px; flex-wrap: wrap;
}
.nav-link {
  color: rgba(255,255,255,.9); text-decoration: none; font-size: 15px;
  padding: 6px 16px; border-radius: 999px; transition: .15s;
}
.nav-link:hover { background: rgba(255,255,255,.18); color: #fff; }
.nav-link.active { background: #fff; color: #138101; font-weight: 600; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}

/* 按钮 */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #f3c2c4; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-logout { border-color: #f3c2c4; color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; text-align: center; margin-top: 8px; }

/* 提示 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: #e7f6ee; color: #1c7a4a; }
.flash-danger { background: #fdeaea; color: #c0392b; }
.flash-warning { background: #fff6e5; color: #b9740a; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.req { color: var(--danger); }

/* 登录 */
.auth-wrap { display: flex; justify-content: center; padding-top: 60px; }
.auth-card { width: 360px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card form { margin-top: 14px; }
.auth-card .muted { margin-top: 14px; }

/* 注册表单 */
.auth-card { width: 420px; }
.auth-card .req { color: #d93025; }
.role-choice {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.role-option {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  transition: .15s;
}
.role-option:hover { border-color: #138101; }
.role-option input { margin: 0 0 4px; }
.role-title { font-weight: 600; font-size: 15px; }
.role-desc { font-size: 12px; color: var(--muted, #888); line-height: 1.4; }
.captcha-row {
  display: flex; align-items: center; gap: 12px;
}
.captcha-q {
  flex-shrink: 0;
  background: #f0f7ef;
  border: 1px dashed #138101;
  color: #138101;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: 8px;
}

/* 表单 */
form label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
form input[type=text], form input[type=password], form input[type=number],
form select, form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
form textarea { resize: vertical; }
.code-area { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; }
.check { font-weight: 400 !important; display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.form-card { max-width: 720px; }
.form-foot { margin-top: 18px; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type=text] { flex: 1; min-width: 200px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; }
.toolbar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; }

/* 网格卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }.snippet-card { display: flex; flex-direction: column; padding: 12px; }
.snippet-top { display: flex; gap: 8px; margin-bottom: 6px; }
.tag { background: #eef2ff; color: var(--primary); padding: 2px 10px; border-radius: 999px; font-size: 11px; }
.tag-free { background: #e7f6ee; color: var(--ok); padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.lang { background: #eef6f0; color: var(--ok); padding: 2px 10px; border-radius: 999px; font-size: 11px; }
.snippet-card h3 { margin: 4px 0; font-size: 14px; }
.snippet-card h3 a { color: var(--ink); text-decoration: none; }
.snippet-problem { font-size: 12px; margin: 4px 0; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.snippet-meta { font-size: 11px; color: var(--muted); margin: 6px 0; }
.snippet-meta .sm-date { margin-bottom: 2px; }
.snippet-meta .sm-stats { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.snippet-meta .sm-stats span { white-space: nowrap; }
.snippet-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* 详情 */
.detail-card h3 { margin: 18px 0 8px; font-size: 15px; }
.detail-tags { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.problem-text { white-space: pre-wrap; background: #fafbff; padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.code-block {
  background: #1e2230; color: #e6e9f2; padding: 14px; border-radius: 10px;
  overflow-x: auto; white-space: pre; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px; line-height: 1.5;
}
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { padding: 10px 0; border-bottom: 1px dashed var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-icon { font-size: 22px; line-height: 1; }
.file-name { color: #d93025; font-weight: 600; }
.del-form { margin-top: 22px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f7f9fd; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.ops { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat { flex: 1; text-align: center; }
.stat-num { font-size: 30px; font-weight: 700; color: var(--primary); }

.badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge-admin { background: #eef2ff; color: var(--primary); }
.badge.ok { background: #e7f6ee; color: var(--ok); }
.badge.off { background: #f1f1f1; color: var(--muted); }

.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; }
.exist-files { margin-top: 8px; }
.exist-files ul { margin: 6px 0; padding-left: 18px; }

/* 账户类型单选 */
.radio-row { display: flex; gap: 18px; margin: 6px 0 2px; }
.radio { font-weight: 400 !important; display: flex; align-items: center; gap: 6px; margin: 0 !important; }
.radio input { width: auto; }
.hint { font-size: 12px; color: var(--muted); background: #f7f9fd; padding: 8px 10px; border-radius: 8px; margin: 6px 0 0; line-height: 1.5; }

/* 代码块工具栏 + 高亮 */
.code-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #1e2230; }
.code-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #161a26; border-bottom: 1px solid #2b3142;
}
.lang-label { color: #8a93a8; font-size: 12px; font-family: Consolas, monospace; }
.code-btn {
  margin-left: auto; background: #2b3142; color: #cdd3e0;
  border: 1px solid #3a4258; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.code-btn:hover { background: #353c52; color: #fff; }
.code-btn:disabled { opacity: .6; cursor: default; }
.code-block {
  background: #1e2230; color: #e6e9f2; padding: 14px; margin: 0;
  /* 窗口高度固定，超出部分纵向滚动，避免页面被长代码拉得很长 */
  max-height: 460px;
  overflow: auto;
  overscroll-behavior: contain;
  white-space: pre; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px; line-height: 1.55;
}
.code-block code { font-family: inherit; background: none; padding: 0; }

/* 图片预览 */
.img-item { background: #fafbff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.img-item img { max-width: 100%; max-height: 360px; border-radius: 6px; display: block; margin-bottom: 6px; background: #fff; }
.img-name { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 图片画廊：横向滚动翻页，scroll-snap 居中停在每张图 */
.img-gallery {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 12px;
}
.img-gallery a {
  flex: 0 0 auto;
  max-width: 88%;
  scroll-snap-align: center;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  line-height: 0;
}
.img-gallery a img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 520px;
  display: block;
  margin: 0 auto;
}
.img-gallery a:hover img { opacity: .92; }
.gallery-title { text-align: center; }
.gallery-hint { text-align: center; color: #8a94a6; font-size: 13px; margin: 6px 0 2px; }
.img-manage { margin-top: 10px; }
.img-manage summary { cursor: pointer; padding: 4px 0; }
.img-manage ul { padding-left: 18px; margin: 6px 0; }

/* 视频区：统一用 aspect-ratio 等比缩放，桌面/手机同一套规则，横竖对所有平台生效 */
.video-block { background: #fafbff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 4px 0 10px; }
.video-iframe-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;          /* 横屏默认 16:9 */
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
/* 竖屏：9:16，限宽居中，避免页面被拉得过长 */
.video-iframe-wrap.video-portrait {
  aspect-ratio: 9 / 16;
  max-width: 420px;
  margin: 0 auto;
}
/* 横屏：满宽但限制最大宽度，避免大屏上过高 */
.video-iframe-wrap.video-landscape {
  max-width: 860px;
  margin: 0 auto;
}
.video-iframe-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}
/* 兜底：不支持 aspect-ratio 的旧浏览器改用 padding-top 撑高 */
@supports not (aspect-ratio: 1 / 1) {
  .video-iframe-wrap { padding-top: 56.25%; height: 0; }
  .video-iframe-wrap.video-portrait { padding-top: 177.78%; }
}

/* 视频兜底链接：第三方播放器打不开时，直接跳转原平台观看 */
.video-fallback { margin: 8px 0 0; font-size: 13px; text-align: center; }
.video-fallback a { color: var(--primary); text-decoration: none; font-weight: 600; }
.video-fallback a:hover { color: var(--primary-d); text-decoration: underline; }

/* 表单：视频方向单选 + 实时预览 */
.radio-row { display: flex; gap: 18px; margin: 2px 0 6px; }
.radio-inline { display: flex; align-items: center; gap: 5px; font-weight: normal; cursor: pointer; }
.radio-inline input { margin: 0; }
.video-preview { margin: 10px 0; padding: 10px; background: #f6f7fb; border: 1px dashed var(--border); border-radius: 8px; }
.video-preview .video-iframe-wrap { margin-top: 6px; }



/* 卡片封面 */
.snippet-cover {
  display: block;
  position: relative;
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #f3f5fb;
}
.snippet-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-badge {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.65); color: #fff;
  padding: 2px 8px; border-radius: 999px; font-size: 12px;
}
.cover-video {
  position: absolute; left: 8px; top: 8px;
  background: rgba(229,72,77,.92); color: #fff;
  padding: 2px 8px; border-radius: 6px; font-size: 12px;
}

/* 上传分区 */
.upload-section {
  background: #fafbff;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}
.upload-section label { margin-top: 0; }
.upload-section .hint { margin-top: 8px; }

.badge-viewer { background: #fff0e8; color: #c97a2c; }
.badge-uploader { background: #e8f0ff; color: #2f57d4; }

/* 资源唯一编号 */
.uid { background: #f1f1f5; color: var(--muted); padding: 2px 8px; border-radius: 6px; font-size: 11px; font-family: Consolas, monospace; }

/* 未授权：代码预览遮罩 */
.preview-wrap { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #1e2230; }
.preview-wrap .code-block { max-height: 320px; overflow: hidden; }
.preview-mask {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(rgba(30,34,48,.15), rgba(30,34,48,.85));
  color: #fff; text-align: center; padding: 20px;
}
.preview-lock { font-size: 42px; }
.preview-mask p { margin: 0; font-size: 14px; opacity: .9; }

/* 附件隐藏提示 */
.att-hidden { background: #f7f9fd; border: 1px dashed var(--border); border-radius: 8px; padding: 16px; color: var(--muted); text-align: center; }

/* 二维码弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,24,34,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: #fff; border-radius: 14px; width: 340px; max-width: 92vw; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px; text-align: center; }
.qr-img { width: 200px; height: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; }
.qr-placeholder { width: 200px; height: 200px; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: #f1f1f5; border-radius: 10px; color: var(--muted); font-size: 13px; }
.qr-text { font-size: 15px; margin: 14px 0 6px; }
.modal-foot { padding: 0 18px 18px; }
.modal-foot .btn { width: 100%; }

/* 授权表单 */
.grant-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.grant-field { flex: 1; min-width: 220px; }
.grant-field label { margin-bottom: 6px; }
.grant-form .btn { margin-bottom: 2px; }
.card > h3 { margin: 0 0 14px; font-size: 15px; }

/* ========== 新增：两栏布局 + 左侧分类导航 ========== */
.layout-with-side {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.side-nav {
  width: 200px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.side-nav-head {
  font-weight: 700;
  font-size: 14px;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  color: var(--ink);
}
.side-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side-nav-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: .15s;
}
.side-nav-list li a:hover {
  background: #f7f9fd;
  color: var(--primary);
}
.side-nav-list li.active a {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}
.cat-name { flex: 1; }
.cat-count {
  font-size: 12px;
  color: var(--muted);
  background: #f1f1f5;
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.side-nav-list li.active .cat-count {
  background: #fff;
  color: var(--primary);
}
.side-nav-tip {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}
.main-list { flex: 1; min-width: 0; }

.filter-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.filter-cat {
  background: #eef2ff; color: var(--primary);
  padding: 2px 10px; border-radius: 999px; font-weight: 600;
}
.filter-clear { margin-left: auto; color: var(--danger); text-decoration: none; font-size: 13px; }

/* ========== 广场排序栏 ========== */
.sort-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; margin-bottom: 14px; font-size: 13px;
}
.sort-label { color: var(--muted); }
.sort-link {
  padding: 4px 12px; border-radius: 999px; text-decoration: none;
  color: var(--muted); border: 1px solid var(--border); background: #fff;
  transition: all .15s; white-space: nowrap;
}
.sort-link:hover { border-color: var(--primary); color: var(--primary); }
.sort-link.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ========== 详情页统计文字（纯文字，无图标） ========== */
.stat-item { font-size: 12px; color: var(--muted); }
.stat-item strong { color: var(--ink); }
.stat-date { font-size: 12px; }

/* 响应式：小屏时隐藏左侧 */
@media (max-width: 720px) {
  .layout-with-side { flex-direction: column; }
  .side-nav { width: 100%; position: static; max-height: none; }
}

/* ========== 分区 tab（全部/付费/免费） ========== */
.zone-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.zone-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  background: #fff;
  transition: .15s;
}
.zone-tab:hover { border-color: var(--primary); color: var(--primary); }
.zone-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

/* ========== 求助区 ========== */
.help-list { display: flex; flex-direction: column; gap: 14px; }
.help-card { padding: 0; overflow: hidden; }
a.help-card-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
  transition: transform .15s, box-shadow .15s;
}
a.help-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(19,129,1,.12);
}
a.help-card-link:hover h3 { color: #138101; }
.help-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.help-summary::-webkit-details-marker { display: none; }
.help-summary:hover { background: #fafbff; }
.help-summary-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.help-summary-main h3 { margin: 0; font-size: 17px; }
.help-summary-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.help-arrow { color: #138101; font-size: 13px; white-space: nowrap; font-weight: 600; }
.reward-tag {
  display: inline-block;
  background: #fff0dc;
  color: #d46b08;
  border: 1px solid #ffd9a8;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
/* 求助帖解决状态标签 */
.status-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.status-tag.status-unresolved { background: #d93025; color: #fff; border: 1px solid #d93025; }
.status-tag.status-solving { background: #ff9800; color: #fff; border: 1px solid #ff9800; }
.status-tag.status-resolved { background: #138101; color: #fff; border: 1px solid #138101; }
/* 筛选标签行 */
.filter-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}
.filter-tabs.status-tabs {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.filter-tab {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  color: var(--ink);
  background: #f2f3f7;
  border: 1px solid transparent;
  transition: .15s;
  white-space: nowrap;
}
.filter-tab:hover { background: #e7f6ee; color: #138101; }
.filter-tab.active {
  background: #138101;
  color: #fff;
  font-weight: 600;
}
.sort-spacer { flex: 1; }
.filter-tab.sort-tab {
  background: #fff;
  border-color: var(--border);
  color: var(--muted);
}
.filter-tab.sort-tab.active { background: #138101; color: #fff; border-color: #138101; }
.help-expand { color: var(--primary); font-size: 13px; white-space: nowrap; }
.help-card[open] .help-expand { transform: rotate(180deg); }
.help-expand { display: inline-block; transition: transform .2s; }
.help-body {
  padding: 0 18px 18px;
  border-top: 1px dashed var(--border);
}
.help-detail { padding: 22px 24px; }
.help-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.help-detail-head h2 { margin: 0; font-size: 22px; }
.help-detail .help-content { margin-top: 4px; }
/* 求助区类别标签醒目样式 */
.help-summary-main .tag,
.help-detail-head .tag {
  background: #138101;
  color: #fff;
  border: 1px solid #138101;
  padding: 3px 12px;
  font-weight: 700;
}
.help-content {
  white-space: pre-wrap;
  margin: 14px 0;
  color: var(--ink);
  line-height: 1.7;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  max-height: 420px;
  overflow-y: auto;
}
.help-imgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  align-items: center;
}
.help-imgs img {
  max-width: 100%;
  max-height: 420px;
  height: auto;
  width: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}
.help-card .file-list { margin-top: 8px; }
.admin-help-card .help-summary { cursor: pointer; }
.admin-contact {
  background: #fff6e5;
  border: 1px solid #fde2c5;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 12px 0;
  font-size: 14px;
  color: #8a5a10;
}
.admin-help-card .uid { font-family: monospace; }

/* ==========================================================
   底部页脚（含 ICP 备案号悬挂）
   ========================================================== */
.site-footer {
  margin-top: 40px;
  background: #f5f7f5;
  border-top: 1px solid var(--border);
  padding: 24px 16px;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-links a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}
.footer-beian { margin: 0; font-size: 13px; }
.footer-beian a {
  color: #6b7280;
  text-decoration: none;
}
.footer-beian a:hover { color: var(--primary); text-decoration: underline; }
.footer-beian .beian-ga {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 14px;
}
.footer-beian .beian-ga img {
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
}

/* ==========================================================
   移动端适配（手机浏览）
   ========================================================== */

/* 平板：≤900px —— 导航与搜索适当收缩 */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .nav { order: 3; width: 100%; }
  .topbar-actions { order: 2; flex-wrap: nowrap; }
  .brand { font-size: 20px; }
  .brand-logo { width: 44px; height: 44px; }
  .topbar-search { flex: 1 1 0; }
  .topbar-search input { min-width: 100px; font-size: 14px; }
}

/* 手机：≤768px —— 整体改为单列堆叠 */
@media (max-width: 768px) {
  /* 顶部栏：品牌居中，导航横向滚动，搜索框占满一行 */
  .topbar { position: relative; }
  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 12px 14px;
  }
  .brand {
    justify-content: center;
    font-size: 19px;
  }
  .brand-link { justify-content: center; gap: 8px; }
  .brand-logo { width: 40px; height: 40px; }

  /* 导航链接：一行横向滚动，避免换行堆叠 */
  .nav {
    order: 2;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .nav-link { padding: 6px 12px; font-size: 14px; white-space: nowrap; }

  /* 搜索框 + 登录 + 注册：强制同一行，搜索框自动让出空间 */
  .topbar-actions {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 6px;
    flex-wrap: nowrap;          /* 关键：不允许换行 */
  }
  .topbar-search {
    flex: 1 1 0;                /* 基准 0，才会被按钮挤窄 */
    min-width: 0;
  }
  .topbar-search input {
    min-width: 0;
    width: 100%;
    font-size: 14px;
    padding: 9px 10px;
  }
  /* 按钮不参与压缩，保证文字完整 */
  .topbar-actions > .btn-light { flex: 0 0 auto; }
  .topbar-search .btn-light { flex: 0 0 auto; }
  .btn-light { padding: 8px 10px; font-size: 13px; }
  .btn-search, .btn-login, .btn-register { min-width: 52px; }
  .topbar-actions .user {
    font-size: 13px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  /* 内容区留白收紧 */
  .container { padding: 14px 12px; }

  /* 卡片网格：单列 */
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 两栏布局（侧边分类）：改为上下堆叠，分类横向滚动 */
  .layout-with-side { flex-direction: column; gap: 12px; }
  .side-nav {
    width: 100%;
    position: static;
    max-height: none;
  }
  .side-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .side-nav-list li { flex: 0 0 auto; }
  .side-nav-list li a {
    border-left: none;
    border-radius: 999px;
    padding: 6px 12px;
    background: #f1f5f9;
    font-size: 13px;
  }
  .side-nav-list li.active a { border-left: none; }

  /* 页头标题与按钮换行 */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-head h1 { font-size: 20px; }

  /* 筛选/分区标签可横向滚动 */
  .zone-tabs, .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 求助内容滚动区高度下调 */
  .help-content { max-height: 320px; }

  /* 图片等比缩放，防止撑破屏幕 */
  .help-imgs img { max-height: 300px; }
  .img-gallery img { max-width: 100%; }

  /* 表单控件全宽，避免横向滚动 */
  .form-card input[type="text"],
  .form-card input[type="password"],
  .form-card input[type="email"],
  .form-card select,
  .form-card textarea {
    width: 100%;
    box-sizing: border-box;
  }
  .form-card textarea.code-area { min-height: 200px; }

  /* 授权表单、操作区纵向排列 */
  .grant-form { flex-direction: column; align-items: stretch; }
  .ops { display: flex; flex-wrap: wrap; gap: 6px; }

  /* 页脚收紧 */
  .site-footer { padding: 18px 12px; margin-top: 24px; }
  .footer-links { gap: 12px; }
}

/* 超小屏：≤420px */
@media (max-width: 420px) {
  .brand { font-size: 17px; }
  .brand-logo { width: 34px; height: 34px; }
  .nav-link { padding: 5px 10px; font-size: 13px; }
  .container { padding: 12px 10px; }
  .page-head h1 { font-size: 18px; }
  .footer-links { gap: 10px; font-size: 13px; }

  /* 顶栏：三件套继续收紧，仍保持一行 */
  .topbar-actions { gap: 5px; }
  .topbar-search input { font-size: 13px; padding: 8px 8px; }
  .topbar-actions .btn-light { padding: 7px 8px; font-size: 12.5px; }
  .btn-search, .btn-login, .btn-register { min-width: 46px; }
  .topbar-actions .user { font-size: 12px; }

  /* 竖屏视频超小屏再收一点 */
  .video-iframe-wrap.video-portrait { max-width: 250px; }
}

/* ==========================================================
   手机端「详情页」精细化（资源详情 / 求助详情）
   放在所有规则之后，覆盖前面的桌面样式
   ========================================================== */
@media (max-width: 768px) {

  /* ---------- 页头：标题与操作按钮 ---------- */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-head h1 {
    font-size: 19px;
    line-height: 1.4;
    font-weight: 700;
    /* 长标题自动换行，避免撑破 */
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  /* 操作按钮组：横排铺开、加大触摸区 */
  .page-head > div {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .page-head .btn {
    flex: 1 1 auto;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    font-size: 14px;
  }

  /* ---------- 详情卡片 ---------- */
  .detail-card {
    padding: 14px;
    border-radius: 12px;
  }

  /* ---------- 顶部标签区：自动换行，不再挤成一条 ---------- */
  .detail-tags {
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
    margin-bottom: 10px;
  }
  .detail-tags .tag,
  .detail-tags .tag-free,
  .detail-tags .stat-item,
  .detail-tags .uid {
    font-size: 12px;
    padding: 3px 9px;
    white-space: nowrap;
  }
  /* 「更新于」这类说明文字单独占一行 */
  .detail-tags .muted {
    flex: 1 1 100%;
    font-size: 12px;
  }

  /* ---------- 分区小标题：加左侧色条，层次更清晰 ---------- */
  .detail-card h3 {
    font-size: 15px;
    margin: 22px 0 10px;
    padding-left: 10px;
    line-height: 1.35;
    border-left: 3px solid var(--primary);
    color: var(--ink);
  }
  .detail-card h3:first-of-type { margin-top: 14px; }

  /* ---------- 解决的问题 ---------- */
  .problem-text {
    padding: 12px;
    font-size: 14px;
    line-height: 1.7;
    border-radius: 10px;
  }

  /* ---------- 附件列表：卡片化，文件名可换行 ---------- */
  .file-list li {
    padding: 12px 0;
    gap: 8px 10px;
    align-items: center;
  }
  .file-icon { font-size: 20px; flex-shrink: 0; }
  .file-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    /* 长文件名自动折行，不再撑出横向滚动 */
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .file-list li .muted { font-size: 12px; }
  /* 下载/删除按钮加大，方便手指点 */
  .file-list li .btn {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .link-danger {
    font-size: 14px;
    padding: 8px 6px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* ---------- 代码块 ---------- */
  .code-wrap { border-radius: 10px; }
  .code-toolbar {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .lang-label { font-size: 12px; }
  .code-btn {
    padding: 7px 14px;
    font-size: 13px;
    min-height: 34px;
    border-radius: 8px;
  }
  .code-block {
    padding: 12px;
    font-size: 12.5px;
    line-height: 1.6;
    /* 手机上高度收窄，横向 + 纵向都能滑 */
    max-height: 300px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---------- 未授权遮罩 ---------- */
  .preview-wrap .code-block { max-height: 260px; }
  .preview-mask {
    padding: 20px 14px;
    text-align: center;
  }
  .preview-lock { font-size: 26px; }
  .preview-mask p { font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
  .preview-mask .btn { width: 100%; min-height: 40px; }

  /* ---------- 图片画廊 ---------- */
  .img-gallery { gap: 12px; }
  .img-gallery a {
    width: 86%;
    border-radius: 10px;
  }
  .img-gallery a img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
  }
  .img-manage { margin-top: 12px; }
  .img-manage ul { padding-left: 16px; }
  .img-manage li { font-size: 13px; line-height: 1.8; word-break: break-word; }

  /* ---------- 视频区：沿用 aspect-ratio，仅调整窄屏限宽 ---------- */
  .video-block { padding: 8px; border-radius: 10px; }
  .video-iframe-wrap.video-landscape { max-width: 100%; }   /* 横屏满宽 */
  .video-iframe-wrap.video-portrait { max-width: 360px; }   /* 竖屏限宽，避免页面过长 */
  /* 兜底：旧浏览器用 padding-top 撑高 */
  @supports not (aspect-ratio: 1 / 1) {
    .video-iframe-wrap { padding-top: 56.25% !important; height: 0 !important; }
    .video-iframe-wrap.video-portrait { padding-top: 177.78% !important; }
  }

  /* ---------- 二维码弹窗 ---------- */
  .modal {
    width: calc(100% - 32px);
    max-width: 340px;
    margin: 0 16px;
  }
  .qr-img { max-width: 100%; }

  /* ---------- 底部操作（删除等） ---------- */
  .del-form { margin-top: 18px; }
  .del-form .btn,
  .detail-card .btn-danger {
    width: 100%;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ---------- 求助详情页 ---------- */
  .help-detail { padding: 14px; }
  .help-detail-head h2 {
    font-size: 18px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .help-detail-head .tag,
  .help-detail-head .reward-tag,
  .help-detail-head .status-tag {
    font-size: 12px;
  }
  .help-content {
    max-height: 340px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.75;
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .help-imgs { gap: 10px; }
  .help-imgs img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
  }
  .help-detail .file-list li { padding: 11px 0; }

  /* ---------- 通用：表格在手机上可横滑 ---------- */
  .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .table th, .table td { padding: 10px 12px; font-size: 13px; }

  /* ---------- 通用：统计块 ---------- */
  .stats { gap: 10px; }
  .stat-num { font-size: 24px; }
}

/* ==========================================================
   手机端补充：观感增强（附件卡片化 / 图片灯箱 / iOS 安全区）
   ========================================================== */

/* 全局：禁止 iOS 横屏字体自动放大、去掉点击高亮块 */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

/* ---------- 图片灯箱（全屏预览） ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .92);
  touch-action: none;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 96vw;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 6px;
}
.lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-nav.show { display: block; }
.lb-count {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
}

@media (max-width: 768px) {

  /* ---------- 顶部 meta 区做成浅底卡片，信息不再散 ---------- */
  .detail-tags {
    background: #f7f9fd;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    row-gap: 8px;
  }
  .detail-tags .tag,
  .detail-tags .tag-free {
    border-radius: 999px;
    font-weight: 600;
  }
  .detail-tags .uid,
  .detail-tags .stat-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
  }

  /* ---------- 附件列表：卡片化，去掉虚线分隔 ---------- */
  .file-list li {
    background: #fbfcff;
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
  }
  .file-list li:last-child { margin-bottom: 0; }

  /* ---------- 分区小标题上方留白 + 淡分隔，层次更顺 ---------- */
  .detail-card h3 {
    padding-top: 4px;
    margin-top: 24px;
  }
  .detail-card h3 + * { margin-top: 0; }

  /* ---------- 图片：圆角阴影 + 点击放大提示 ---------- */
  .img-gallery a {
    border: none;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
    background: #f4f6fb;
  }
  .img-gallery a img { display: block; }

  /* ---------- 未授权提示块 ---------- */
  .att-hidden {
    padding: 14px 12px;
    font-size: 13.5px;
    line-height: 1.7;
    border-radius: 10px;
  }

  /* ---------- 底部留出 iOS 安全区，避免被小黑条遮住 ---------- */
  .site-footer {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

/* ---------- 联系作者卡片 ---------- */
.contact-author {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 16px 0 4px;
  padding: 16px 18px;
}
.contact-author .ca-qr {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.contact-author .ca-qr img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.contact-author .ca-qr-tip {
  font-size: 12px;
  color: var(--muted);
}
.contact-author .ca-info { min-width: 0; }
.contact-author .ca-info h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--primary);
}
.contact-author .ca-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  line-height: 1.5;
}
.contact-author .ca-list a { color: var(--primary); }
.contact-author .ca-label {
  display: inline-block;
  min-width: 48px;
  font-weight: 600;
  color: var(--text);
}

/* 超小屏：≤420px 进一步收紧 */
@media (max-width: 420px) {
  .page-head h1 { font-size: 17px; }
  .contact-author { flex-direction: column; text-align: center; gap: 12px; }
  .contact-author .ca-info h3 { font-size: 15px; }
  .contact-author .ca-list { align-items: center; }
  .detail-card { padding: 12px; }
  .detail-card h3 { font-size: 14px; margin: 18px 0 8px; }
  .code-block { font-size: 12px; padding: 10px; max-height: 260px; }
  .img-gallery a img { max-height: 320px; }
  .help-content { max-height: 300px; font-size: 13.5px; }
  .file-list li .btn { padding: 8px 12px; font-size: 13px; }
  .stat-num { font-size: 22px; }
}
