:root {
  --bg: #F6EAD3;
  --surface: #FFF8EA;
  --primary: #B4462E;
  --accent: #E08A2E;
  --text: #2E2118;
  --muted: #8A7360;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(46, 33, 24, 0.12);
  --shadow-hover: 0 12px 26px rgba(46, 33, 24, 0.2);
  --font-heading: Georgia, 'Times New Roman', 'Noto Serif SC', serif;
  --font-body: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --line: rgba(138, 115, 96, 0.25);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  background-image:
    radial-gradient(rgba(138, 115, 96, 0.06) 1px, transparent 1px);
  background-size: 5px 5px;
}

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 20px;
}

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(46, 33, 24, 0.06);
}

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

.logo {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo img { height: 36px; width: auto; }

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

.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 8px 14px;
  border-radius: calc(var(--radius) / 2);
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav a:hover,
.nav a.active {
  background: var(--primary);
  color: var(--surface);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 16px;
  min-width: 200px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.search-box input::placeholder { color: var(--muted); }

.search-box button {
  border: none;
  background: var(--primary);
  color: var(--surface);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.2s;
}

.search-box button:hover { background: var(--accent); }

/* ===== Hero / 轮播 ===== */
.hero {
  position: relative;
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-slide {
  position: relative;
  display: block;
  min-height: 320px;
}

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

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(46, 33, 24, 0.85) 0%, rgba(46, 33, 24, 0.35) 55%, transparent 100%);
}

.hero-info {
  position: relative;
  z-index: 2;
  padding: 48px 40px;
  max-width: 560px;
  color: var(--surface);
}

.hero-info h2 {
  font-family: var(--font-heading);
  font-size: 32px;
  margin-bottom: 12px;
  line-height: 1.25;
}

.hero-info p {
  color: rgba(255, 248, 234, 0.85);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  font-weight: 600;
  padding: 10px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  transition: transform 0.2s, background 0.2s;
}

.btn:hover {
  background: var(--primary);
  color: var(--surface);
  transform: translateY(-2px);
}

/* ===== Section ===== */
.sec { margin: 36px 0; }

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.sec-title {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--primary);
  position: relative;
  padding-left: 16px;
}

.sec-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 22px;
  border-radius: 3px;
  background: var(--accent);
}

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

.sec-more:hover { color: var(--primary); }

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

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--bg);
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.card:hover .card-cover img { transform: scale(1.06); }

.card-score {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: var(--surface);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.cat-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, background 0.2s;
  border: 1.5px solid transparent;
}

.cat-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.cat-item a { display: block; font-weight: 600; color: var(--text); }

.cat-count {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 10px;
}

/* ===== 排行榜 ===== */
.rank-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 18px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

.rank-item:last-child { border-bottom: none; }

.rank-num {
  flex: 0 0 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
}

.rank-item:nth-child(-n+3) .rank-num {
  background: var(--primary);
  color: var(--surface);
}

.rank-title {
  flex: 1;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-title:hover { color: var(--primary); }

.rank-score {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

/* ===== 详情页 ===== */
.detail {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 24px 0;
}

.detail-head {
  display: flex;
  gap: 28px;
  margin-bottom: 24px;
}

.detail-cover {
  flex: 0 0 240px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.detail-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-meta h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  color: var(--primary);
  line-height: 1.3;
}

.detail-meta p { color: var(--muted); font-size: 14px; }

.detail-score {
  display: inline-block;
  background: var(--accent);
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  padding: 4px 16px;
  border-radius: 999px;
  align-self: flex-start;
}

.detail-body {
  border-top: 2px dashed var(--line);
  padding-top: 20px;
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
}

.detail-body h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--primary);
  margin: 18px 0 10px;
}

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

.tag {
  display: inline-block;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  transition: background 0.2s, color 0.2s;
}

.tag:hover {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

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

.pg {
  display: inline-block;
  min-width: 38px;
  height: 38px;
  line-height: 36px;
  text-align: center;
  padding: 0 12px;
  border-radius: calc(var(--radius) / 2);
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--line);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.pg:hover { border-color: var(--primary); color: var(--primary); }

.pg.current {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
  font-weight: 700;
}

.pg.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

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

.link-item {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: color 0.2s, border-color 0.2s;
}

.link-item:hover { color: var(--primary); border-color: var(--primary); }

/* ===== 面包屑 ===== */
.crumbs {
  font-size: 13px;
  color: var(--muted);
  padding: 14px 0;
}

.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs span { margin: 0 6px; }

/* ===== 搜索高亮 ===== */
.hl {
  color: var(--primary);
  background: rgba(224, 138, 46, 0.22);
  border-radius: 4px;
  padding: 0 2px;
  font-weight: 600;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--surface);
  border-top: 2px solid var(--line);
  margin-top: 48px;
  padding: 32px 0 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer .wrap { display: flex; flex-direction: column; gap: 10px; }

.footer a { color: var(--muted); }
.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); }
}

@media (max-width: 768px) {
  .header .wrap {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }

  .logo { font-size: 20px; }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .nav a { padding: 6px 12px; font-size: 14px; }

  .search-box {
    order: 2;
    margin-left: auto;
    min-width: 0;
    flex: 0 1 auto;
  }

  .search-box input { width: 100px; }

  .hero-slide { min-height: 260px; }
  .hero-info { padding: 28px 20px; max-width: 100%; }
  .hero-info h2 { font-size: 22px; }
  .hero-info p { font-size: 13px; -webkit-line-clamp: 2; }

  .sec { margin: 24px 0; }
  .sec-title { font-size: 19px; }

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

  .detail { padding: 18px; }
  .detail-head { flex-direction: column; gap: 18px; }
  .detail-cover { flex: none; width: 60%; margin: 0 auto; }
  .detail-meta h1 { font-size: 22px; }

  .rank-list { padding: 8px 12px; }
  .rank-title { font-size: 14px; }

  .pg { min-width: 34px; height: 34px; line-height: 32px; padding: 0 10px; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-list { grid-template-columns: repeat(2, 1fr); }
  .detail-cover { width: 70%; }
}