:root {
  --bg: #EDF1F5;
  --surface: #FFFFFF;
  --primary: #7A5CFF;
  --accent: #FF5FA2;
  --text: #1B2230;
  --muted: #8A94A6;
  --radius: 6px;
  --font-heading: 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --grad: linear-gradient(135deg, #7A5CFF 0%, #FF5FA2 100%);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(27, 34, 48, 0.015) 0px,
    rgba(27, 34, 48, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ Header ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(237, 241, 245, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(122, 92, 255, 0.08);
}

.header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover {
  color: var(--primary);
  background: rgba(122, 92, 255, 0.06);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid rgba(138, 148, 166, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  width: 150px;
}
.search-box input::placeholder { color: var(--muted); }
.search-box button {
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-body);
  color: #fff;
  background: var(--grad);
  transition: opacity 0.2s;
}
.search-box button:hover { opacity: 0.88; }

/* ============ Button ============ */
.btn {
  display: inline-block;
  padding: 9px 22px;
  font-size: 14px;
  font-family: var(--font-body);
  color: #fff;
  background: var(--grad);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ============ Hero 轮播 ============ */
.hero {
  position: relative;
  margin: 28px 0 40px;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background: var(--surface);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: heroFade 15s infinite;
}
.hero-slide:nth-child(1) { animation-delay: 0s; }
.hero-slide:nth-child(2) { animation-delay: 5s; }
.hero-slide:nth-child(3) { animation-delay: 10s; }

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(27, 34, 48, 0.78) 0%, rgba(27, 34, 48, 0.15) 55%, transparent 100%);
}

@keyframes heroFade {
  0% { opacity: 0; }
  4% { opacity: 1; }
  30% { opacity: 1; }
  34% { opacity: 0; }
  100% { opacity: 0; }
}

.hero-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 32px 40px;
  color: #fff;
  max-width: 640px;
}
.hero-info h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
}
.hero-info p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ Section ============ */
.sec { margin-bottom: 48px; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(138, 148, 166, 0.16);
}

.sec-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.04em;
  position: relative;
  padding-left: 14px;
}
.sec-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--grad);
}

.sec-more {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s;
}
.sec-more:hover { color: var(--accent); }

/* ============ Grid & Card ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease;
}
.card:hover { transform: translateY(-3px); }

.card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #dfe5ec;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.card:hover .card-cover img { transform: scale(1.05); }

.card:hover .card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--grad) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card-score {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 3px 12px 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
  clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

.card-info { padding: 10px 12px 14px; }

.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}
.card:hover .card-title { color: var(--primary); }

.card-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  white-space: nowrap;
  overflow: hidden;
}

/* ============ 分类 ============ */
.cat-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(138, 148, 166, 0.12);
  transition: border-color 0.2s, transform 0.2s;
}
.cat-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.cat-item span:first-child,
.cat-item .cat-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.cat-count {
  font-size: 12px;
  color: var(--muted);
}

/* ============ 排行榜 ============ */
.rank-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 32px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  transition: background 0.2s;
}
.rank-item:hover { background: rgba(122, 92, 255, 0.05); }

.rank-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius);
}
.rank-item:nth-child(1) .rank-num,
.rank-item:nth-child(2) .rank-num,
.rank-item:nth-child(3) .rank-num {
  color: #fff;
  background: var(--grad);
}

.rank-title {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-item:hover .rank-title { color: var(--primary); }

.rank-score {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ============ 详情页 ============ */
.detail { margin: 32px 0 48px; }

.detail-head {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 36px;
  align-items: start;
}

.detail-cover {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dfe5ec;
}
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-meta { padding-top: 4px; }

.detail-meta h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.35;
  margin-bottom: 14px;
}

.detail-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 14px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.detail-score small { font-size: 12px; font-weight: 400; opacity: 0.85; }

.detail-meta p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.detail-meta p strong { color: var(--text); font-weight: 500; }

.detail-body {
  margin-top: 32px;
  padding: 28px 32px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.9;
  color: #3a4354;
}
.detail-body h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 400;
  margin: 24px 0 12px;
  color: var(--text);
}
.detail-body h2:first-child { margin-top: 0; }
.detail-body p { margin-bottom: 12px; }

/* ============ 标签 ============ */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--primary);
  background: rgba(122, 92, 255, 0.08);
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}
.tag:hover {
  color: #fff;
  background: var(--grad);
}

/* ============ 分页 ============ */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 40px 0 16px;
}

.pg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(138, 148, 166, 0.2);
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s;
}
.pg:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.pg.current {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  cursor: default;
}
.pg.disabled {
  color: var(--muted);
  opacity: 0.5;
  pointer-events: none;
}

/* ============ 友链 ============ */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 20px 0;
}

.link-item {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s;
}
.link-item:hover { color: var(--accent); }

/* ============ 面包屑 ============ */
.crumbs {
  padding: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); transition: color 0.2s; }
.crumbs a:hover { color: var(--primary); }
.crumbs span { margin: 0 6px; opacity: 0.5; }

/* ============ 搜索高亮 ============ */
.hl {
  color: var(--accent);
  font-weight: 600;
  background: rgba(255, 95, 162, 0.1);
  border-radius: 2px;
  padding: 0 2px;
}

/* ============ 页脚 ============ */
.footer {
  margin-top: 56px;
  padding: 32px 0 40px;
  border-top: 1px solid rgba(138, 148, 166, 0.16);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
}
.footer a { color: var(--muted); transition: color 0.2s; }
.footer a:hover { color: var(--primary); }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .cat-list { grid-template-columns: repeat(4, 1fr); }
  .hero-info h2 { font-size: 22px; }
}

@media (max-width: 768px) {
  .wrap { padding: 0 16px; }

  .header .wrap {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .logo { font-size: 18px; }
  .nav {
    order: 3;
    width: 100%;
    flex: none;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .search-box { margin-left: auto; }
  .search-box input { width: 110px; }

  .hero {
    aspect-ratio: 4 / 3;
    margin: 16px 0 28px;
  }
  .hero-info { padding: 20px; }
  .hero-info h2 { font-size: 18px; }
  .hero-info p { -webkit-line-clamp: 2; font-size: 12px; }

  .sec { margin-bottom: 32px; }
  .sec-title { font-size: 17px; }

  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-list { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cat-item { padding: 16px 8px; }

  .rank-list { grid-template-columns: 1fr; gap: 8px; }

  .detail-head {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .detail-cover {
    max-width: 200px;
    margin: 0 auto;
  }
  .detail-meta h1 { font-size: 20px; text-align: center; }
  .detail-score { display: flex; justify-content: center; }
  .detail-body { padding: 20px 18px; margin-top: 24px; }

  .pager { gap: 6px; margin: 28px 0 12px; }
  .pg { min-width: 32px; height: 32px; padding: 0 8px; font-size: 12px; }

  .footer { margin-top: 36px; padding: 24px 0 32px; }
}