/* ============================================================
   资源聚合网站 · 全局样式
   风格：简单清爽 / 圆润 / 响应式（手机端优先）
   ============================================================ */

:root {
  /* 色板：清爽浅底 + 蓝紫主题 */
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --primary: #5b6cff;
  --primary-deep: #4a56e8;
  --accent: #8b5cf6;
  --grad: linear-gradient(135deg, #5b6cff 0%, #8b5cf6 100%);
  --text: #23283a;
  --text-2: #6b7280;
  --text-3: #9aa3b2;
  --line: #e8ebf3;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;

  /* 圆角体系 */
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  /* 阴影与动效 */
  --shadow: 0 4px 18px rgba(35, 45, 90, 0.06);
  --shadow-hover: 0 10px 30px rgba(35, 45, 90, 0.12);
  --tr: all 0.25s ease;

  /* 导航栏背景（暗色模式会覆盖） */
  --nav-bg: rgba(255, 255, 255, 0.9);

  /* 原生控件适配（滚动条/表单） */
  color-scheme: light;

  --radius-lg: var(--r-lg);
  --radius-md: var(--r-md);
  --radius-pill: var(--r-pill);
}

* { 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;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============ 暗色模式 ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #13151e;
  --bg-soft: #1a1e2c;
  --card: #1c2130;
  --text: #e8eaf3;
  --text-2: #a7aec8;
  --text-3: #7b829c;
  --line: #2a3146;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.55);
  --nav-bg: rgba(24, 28, 42, 0.92);
}
/* 暗色下标签徽章提亮，保证可读性 */
html[data-theme="dark"] .tag {
  background: rgba(139, 92, 246, 0.18);
  color: #a5b4fc;
}

/* ============ 顶部导航 ============ */
.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  padding: 0 20px;
}
.nav {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.3px;
  margin-right: auto;
}
.logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(91, 108, 255, 0.35);
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin-right: auto; /* 链接靠左，主题按钮靠右 */
}
.nav-links a {
  display: block;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: var(--tr);
}
.nav-links a:hover { background: var(--bg-soft); color: var(--text); }
.nav-links a.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(91, 108, 255, 0.35);
}

/* 主题切换按钮 */
.theme-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--tr);
  flex-shrink: 0;
  margin-left: 4px;
}
.theme-btn:hover { transform: rotate(20deg) scale(1.05); }

/* ============ 首页 Hero ============ */
.hero {
  margin: 26px 0 0;
  padding: 56px 20px 48px;
  border-radius: 28px;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(900px 420px at 10% 110%, rgba(91, 108, 255, 0.14), transparent 60%),
    var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.hero h1 {
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0.5px;
  max-width: 720px;
  margin: 0 auto 14px;
}
.hero h1 em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--text-2);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto 30px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 108, 255, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(91, 108, 255, 0.45); }
.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-sm { padding: 8px 18px; font-size: 13.5px; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ============ 区块标题 ============ */
.section { margin: 44px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grad);
  flex-shrink: 0;
}
.section-more { font-size: 13.5px; color: var(--text-3); font-weight: 500; }

/* ============ 分区卡片（首页） ============ */
.zones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.zone-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow);
  transition: var(--tr);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.zone-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.zone-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.12), rgba(139, 92, 246, 0.12));
}
.zone-card h3 { font-size: 18.5px; font-weight: 700; }
.zone-card p { color: var(--text-2); font-size: 14px; flex: 1; }
.zone-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.zone-count {
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--bg-soft);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.zone-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 16px;
  transition: var(--tr);
}
.zone-card:hover .zone-arrow { background: var(--grad); color: #fff; }

/* ============ 资源卡片列表 ============ */
.res-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.res-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--tr);
  position: relative;
}
.res-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.res-top { display: flex; align-items: flex-start; gap: 10px; }
.res-title { font-size: 16.5px; font-weight: 700; flex: 1; line-height: 1.4; }
.res-hot {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff7a59, #ff4d6d);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  box-shadow: 0 3px 8px rgba(255, 77, 109, 0.3);
  animation: hot-pulse 2s ease-in-out infinite;
}
@keyframes hot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.res-desc {
  color: var(--text-2);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.res-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-deep);
  background: rgba(91, 108, 255, 0.1);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}
.res-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}
.res-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.res-meta .expired-tag {
  color: var(--danger);
  font-weight: 600;
}
.res-card.expired {
  opacity: 0.6;
  filter: grayscale(0.4);
}
.res-card.expired .res-title { color: var(--text-3); }

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  color: var(--text-3);
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 50px 20px;
  box-shadow: var(--shadow);
  font-size: 15px;
}

/* ============ 社群区 ============ */
.community {
  background: var(--grad);
  border-radius: 28px;
  padding: 44px 24px;
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 40px rgba(91, 108, 255, 0.35);
}
.community h2 { font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.community p { opacity: 0.92; font-size: 15px; margin-bottom: 26px; }
.qr-wrap {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
}
.qr-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 18px 18px 14px;
  width: 170px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.qr-box img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  object-fit: contain;
  background: #fff;
}
.qr-box span {
  display: block;
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

/* ============ 页面头部（分区页） ============ */
.page-head {
  margin: 26px 0 0;
  padding: 40px 20px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.page-head .icon { font-size: 40px; margin-bottom: 8px; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head p { color: var(--text-2); font-size: 15px; margin-top: 8px; }
.page-head .stats {
  display: inline-flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-head .stats span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-soft);
  padding: 5px 14px;
  border-radius: var(--r-pill);
}

/* ============ 筛选条 ============ */
.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  outline: none;
  transition: var(--tr);
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91, 108, 255, 0.12); }
.search-bar input::placeholder { color: var(--text-3); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-btn {
  border: none;
  background: var(--card);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--tr);
}
.filter-btn:hover { color: var(--primary); }
.filter-btn.active { background: var(--grad); color: #fff; }

/* ============ 加载提示 ============ */
.load-more {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 22px 0 6px;
}
.load-more .spin {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: -4px;
  border-radius: 50%;
  border: 3px solid var(--bg-soft);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 中转页 ============ */
.redirect-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(91, 108, 255, 0.1), transparent 55%),
    radial-gradient(800px 400px at 90% 100%, rgba(139, 92, 246, 0.12), transparent 55%),
    var(--bg);
}
.redirect-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-hover);
  padding: 44px 40px;
  text-align: center;
  max-width: 420px;
  width: calc(100% - 40px);
}
.spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid var(--bg-soft);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.redirect-card h1 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.redirect-card p { color: var(--text-2); font-size: 14px; }
.redirect-card .tip {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.redirect-card .manual-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}
.redirect-card .manual-link:hover { text-decoration: underline; }
.redirect-card .err-icon { font-size: 44px; margin-bottom: 12px; }

/* 中转页社群引流区（倒计时等待时展示文案 + 群二维码） */
.redirect-community {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1.5px dashed var(--line);
  text-align: center;
}
.rc-title { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; }
.rc-qrs { display: flex; gap: 12px; justify-content: center; }
.rc-qr {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 10px;
  width: 112px;
}
.rc-qr img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #fff;
}
.rc-qr span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ============ 页脚 ============ */
.footer {
  margin-top: auto;
  padding: 30px 20px 26px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.footer .brand { font-weight: 700; color: var(--text-2); }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--primary); }

/* ============ 回到顶部按钮 ============ */
.back-top {
  position: fixed;
  /* 宽屏：按钮整体放在卡片右侧留白中，左缘距卡片右缘 8px，不重叠；留白不足时贴边 */
  right: max(22px, calc((100vw - 1040px) / 2 - 54px));
  bottom: 26px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(91, 108, 255, 0.4);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: var(--tr);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.back-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-top.show:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(91, 108, 255, 0.5);
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .topbar { top: 8px; padding: 0 12px; }
  .nav { padding: 8px 10px; gap: 4px; }
  .nav-links { gap: 2px; }
  .nav-links a { padding: 7px 8px; font-size: 13px; }
  .theme-btn { width: 33px; height: 33px; font-size: 15px; margin-left: 2px; }
  .back-top { right: 14px; bottom: 18px; width: 42px; height: 42px; font-size: 18px; }
  .container { padding: 0 14px; }
  .hero { padding: 38px 18px 34px; border-radius: 24px; margin-top: 16px; }
  .hero p { font-size: 14.5px; }
  .btn { padding: 11px 22px; font-size: 14px; }
  .section { margin: 32px 0; }
  .section-title { font-size: 19px; }
  .zones, .res-list { grid-template-columns: 1fr; }
  .page-head { padding: 30px 16px; border-radius: 24px; margin-top: 16px; }
  .page-head h1 { font-size: 23px; }
  .community { padding: 34px 18px; border-radius: 24px; }
  .qr-box { width: 150px; }
  .res-foot { flex-wrap: wrap; }
}
