:root {
  --bg: #f5f6f8;
  --bg-soft: #eef0f3;
  --bg-card: #ffffff;
  --border: #e0e3e8;
  --text: #1a1d26;
  --text-dim: #6b7280;
  --accent: #ff6a00;
  --accent-soft: #ff8a33;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}
.logo span { color: var(--text); }
.logo small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0;
}
.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}
.nav a {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.search {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-soft);
}
.search input {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 7px 10px;
  width: 150px;
  outline: none;
  font-size: 13px;
}
.search button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn-login {
  font-size: 13px;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
}
.btn-login:hover { background: var(--accent); color: #fff; }

/* ---------- 轮播 ---------- */
.carousel-wrap {
  max-width: 1280px;
  margin: 20px auto 0;
  padding: 0 20px;
}
.carousel {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #e0e3e8;
  aspect-ratio: 1280 / 400;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-slide.active { opacity: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-slide a { position: absolute; inset: 0; z-index: 2; }
.carousel-slide .slide-title {
  position: absolute; bottom: 16px; left: 20px; z-index: 3;
  background: rgba(0,0,0,.55); color: #fff; font-size: 15px;
  padding: 6px 14px; border-radius: 8px;
}
.carousel-dots {
  position: absolute; bottom: 12px; right: 20px; z-index: 10;
  display: flex; gap: 8px;
}
.carousel-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.45); cursor: pointer;
  transition: background .2s;
}
.carousel-dots span.active { background: var(--accent); }
.carousel-arrow {
  position: absolute; top: 50%; z-index: 10;
  transform: translateY(-50%);
  background: rgba(255,255,255,.7); color: var(--text);
  border: none; border-radius: 50%; width: 36px; height: 36px;
  cursor: pointer; font-size: 18px; line-height: 36px; text-align: center;
  transition: background .2s;
}
.carousel-arrow:hover { background: #fff; }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }
.carousel-empty {
  aspect-ratio: 1280 / 400;
  background: linear-gradient(135deg, #f0f2f5, #e4e7ec);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); border-radius: 16px;
  font-size: 15px;
}

/* ---------- 内容区 ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 30px 0 18px;
}
.section-title h2 { font-size: 18px; font-weight: 700; }
.section-title h2::before {
  content: "";
  display: inline-block;
  width: 4px; height: 16px;
  background: var(--accent);
  margin-right: 10px;
  vertical-align: -2px;
  border-radius: 2px;
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #f0f2f5, #e4e7ec);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 10px;
  overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover .tag {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.card-body { padding: 12px 14px 14px; }
.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  height: 40px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-meta {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg-soft);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
}

/* ---------- 汉堡菜单按钮 ---------- */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  background: transparent; border: none; cursor: pointer;
  padding: 6px; flex-direction: column; justify-content: center; gap: 5px;
  align-items: center; z-index: 60;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 响应式：平板 (768px - 1024px) ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .topbar-inner { gap: 16px; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .search input { width: 110px; }
  .carousel { aspect-ratio: 1024 / 320; }
  .carousel-arrow { width: 32px; height: 32px; font-size: 16px; line-height: 32px; }
  .carousel-slide .slide-title { font-size: 14px; padding: 5px 10px; }
  .detail-title { font-size: 20px; }
  .detail-body { padding: 20px; }
}

/* ---------- 响应式：手机 (< 768px) ---------- */
@media (max-width: 767px) {
  .hamburger { display: flex; }
  .nav {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 10px 16px; gap: 2px;
    z-index: 55; box-shadow: 0 8px 24px rgba(0,0,0,.1);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 15px; border-bottom: none; border-left: 3px solid transparent; }
  .nav a.active { border-left-color: var(--accent); border-bottom-color: transparent; }
  .topbar-inner { gap: 10px; }
  .topbar-right { gap: 8px; }
  .search { display: none; }
  .topbar-inner .mobile-search {
    display: flex; margin-top: 8px; width: 100%;
  }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 12px; }
  .card-title { font-size: 13px; height: 36px; }
  .card-meta { font-size: 11px; gap: 10px; }
  .card-actions .act-btn { font-size: 11px; padding: 3px 8px; }
  .container { padding: 16px 12px 40px; }
  .carousel-wrap { padding: 0 12px; margin-top: 12px; }
  .carousel { aspect-ratio: 16 / 7; border-radius: 12px; }
  .carousel-arrow { width: 28px; height: 28px; font-size: 14px; line-height: 28px; }
  .carousel-arrow.prev { left: 6px; }
  .carousel-arrow.next { right: 6px; }
  .carousel-slide .slide-title { font-size: 13px; padding: 4px 10px; bottom: 10px; left: 10px; }
  .carousel-dots span { width: 8px; height: 8px; }
  .carousel-dots { bottom: 8px; right: 10px; gap: 6px; }
  .section-title h2 { font-size: 16px; }
  .section-title { margin: 20px 0 14px; }
  .logo { font-size: 18px; }
  .logo small { font-size: 10px; }
  .btn-login { font-size: 12px; padding: 6px 10px; }
  .footer { padding: 20px 12px; font-size: 12px; }
  .detail { padding: 0 12px; margin: 16px auto; }
  .detail-title { font-size: 18px; }
  .detail-body { padding: 16px; }
  .detail-desc { font-size: 14px; }
  .detail-cover { aspect-ratio: 16/10; }
  .detail-like-btn { padding: 8px 16px; font-size: 14px; }
  .comment-form { flex-wrap: wrap; }
  .comment-form input { min-width: 0; }
  .comment-form input:first-child { width: 100% !important; }
  .download-item { flex-wrap: wrap; gap: 6px; }
  .download-item .dl-btn { width: 100%; text-align: center; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ---------- 响应式：小手机 (< 480px) ---------- */
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .card-cover { aspect-ratio: 16 / 9; }
  .card-meta { flex-wrap: wrap; }
  .topbar-inner { padding: 0 12px; height: 54px; }
  .carousel { aspect-ratio: 4 / 2; }
  .cat-grid { grid-template-columns: 1fr; }
  .pwd-btn-row { flex-direction: column; align-items: flex-start; }
}

/* ---------- 卡片交互：点赞/评论/下载 ---------- */
.card-actions {
  display: flex; gap: 8px; margin-top: 10px; align-items: center;
}
.card-actions .act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-dim); cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; background: var(--bg-soft); transition: all .15s;
}
.card-actions .act-btn:hover { border-color: var(--accent); color: var(--accent); }
.card-actions .act-btn.liked { color: var(--accent); border-color: var(--accent); background: rgba(255,106,0,.08); }
.card-actions .act-btn.download-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.card-actions .act-btn.download-btn:hover { background: var(--accent-soft); }

/* ---------- 详情页评论 ---------- */
.comment-section {
  margin-top: 30px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.comment-section h4 { font-size: 16px; margin-bottom: 14px; }
.comment-form {
  display: flex; gap: 10px; margin-bottom: 18px;
}
.comment-form input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-soft); font-size: 14px;
  color: var(--text); outline: none;
}
.comment-form input:focus { border-color: var(--accent); }
.comment-form button {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 10px 18px; cursor: pointer; font-size: 14px;
}
.comment-list { list-style: none; }
.comment-item {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; line-height: 1.6;
}
.comment-item .c-time { color: var(--text-dim); font-size: 12px; margin-left: 8px; }
.comment-item .c-name { font-weight: 600; color: var(--accent); }

/* ---------- 详情页附件下载 ---------- */
.download-section {
  margin-top: 24px; padding: 18px 20px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px;
}
.download-section h4 { font-size: 15px; margin-bottom: 12px; }
.download-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; transition: border-color .15s;
}
.download-item:hover { border-color: var(--accent); }
.download-item .dl-icon { font-size: 20px; }
.download-item .dl-name { flex: 1; font-size: 14px; font-weight: 500; }
.download-item .dl-size { font-size: 12px; color: var(--text-dim); }
.download-item .dl-btn {
  background: var(--accent); color: #fff; font-size: 12px;
  padding: 5px 14px; border-radius: 6px; cursor: pointer;
  border: none; font-weight: 600;
}

/* ---------- 详情页点赞 ---------- */
.detail-like {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px; cursor: pointer;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-soft);
  font-size: 14px; transition: all .2s;
}
.detail-like:hover { border-color: var(--accent); }
.detail-like.liked { color: var(--accent); border-color: var(--accent); background: rgba(255,106,0,.08); }

/* ---------- 登录态：右上角用户菜单 ---------- */
.user-box { position: relative; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 140px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.12); z-index: 60;
}
.user-menu-name {
  font-size: 13px; color: var(--text); padding: 6px 8px;
  border-bottom: 1px solid var(--border); margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-menu button {
  width: 100%; text-align: left; background: transparent; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 13px; padding: 8px; border-radius: 6px;
}
.user-menu button:hover { background: var(--bg-soft); color: var(--accent); }

/* ---------- 登录/注册弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.modal {
  position: relative; width: 360px; max-width: 92vw;
  background: #fff; border-radius: 14px; padding: 28px 26px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 30px; height: 30px;
  border: none; background: var(--bg-soft); border-radius: 8px; cursor: pointer;
  font-size: 18px; color: var(--text-dim); line-height: 30px;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.modal-tab {
  flex: 1; text-align: center; padding: 10px 0; font-size: 15px; cursor: pointer;
  color: var(--text-dim); border-bottom: 2px solid transparent; transition: all .15s;
}
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal-panel .field { margin-bottom: 14px; }
.modal-panel .field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.modal-panel .field input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); font-size: 14px; color: var(--text); outline: none;
}
.modal-panel .field input:focus { border-color: var(--accent); background: #fff; }
.modal-submit {
  width: 100%; margin-top: 6px; padding: 12px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.modal-submit:hover { background: var(--accent-soft); }
.modal-msg { margin-top: 12px; font-size: 13px; color: var(--text-dim); min-height: 18px; }
.modal-msg.err { color: #e03131; }

/* ---------- 评论：已登录昵名提示 ---------- */
.comment-as {
  font-size: 13px; color: var(--accent); background: rgba(255,106,0,.06);
  border: 1px solid rgba(255,106,0,.2); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px;
}

/* ---------- 后台会员列表 ---------- */
.member-list { margin-top: 6px; }
.member-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.member-table th, .member-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.member-table th { color: var(--text-dim); font-weight: 600; background: var(--bg-soft); }
.member-table tr:hover td { background: var(--bg-soft); }
