/* ===== CSS Variables ===== */
:root {
  --primary: #FF6B00;
  --primary-hover: #E05A00;
  --primary-light: #FFF3E8;
  --bg: #F5F5F5;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #E8E8E8;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.13);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 200px;
  --header-height: 60px;
  --font: "PingFang SC","Microsoft YaHei","Helvetica Neue",sans-serif;
}
[data-theme="dark"] {
  --bg: #121212;
  --bg-card: #1E1E1E;
  --text: #E8E8E8;
  --text-secondary: #AAAAAA;
  --text-muted: #555555;
  --border: #2E2E2E;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.5);
  --primary-light: rgba(255,107,0,0.15);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; }

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  padding: 0 24px; display: flex; align-items: center; gap: 16px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0; }
.logo span { color: var(--text); }
.search-wrap { flex: 1; max-width: 420px; }
.search-input {
  width: 100%; height: 36px; padding: 0 16px;
  border: 1.5px solid var(--border); border-radius: 18px;
  background: var(--bg); color: var(--text);
  font-size: 14px; font-family: var(--font); outline: none;
  transition: border-color 0.2s, background 0.3s;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-muted); }
.theme-toggle {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--bg); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color 0.2s, background 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); background: var(--primary-light); }

/* ===== Top Nav ===== */
.top-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}
.top-nav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 24px;
  overflow-x: auto;
}
.top-nav-list {
  display: flex; align-items: center; gap: 0;
  white-space: nowrap; height: 44px;
}
.top-nav-item a {
  display: block; padding: 0 18px; height: 44px; line-height: 44px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  position: relative; transition: color 0.2s;
}
.top-nav-item a::after {
  content: ''; position: absolute; bottom: 0; left: 18px; right: 18px;
  height: 2px; background: var(--primary); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transition: transform 0.2s;
}
.top-nav-item a:hover { color: var(--primary); }
.top-nav-item a:hover::after { transform: scaleX(1); }
.top-nav-item.active a { color: var(--primary); font-weight: 600; }
.top-nav-item.active a::after { transform: scaleX(1); }

/* ===== Ad Slot ===== */
.ad-slot { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.ad-slot--top { margin-top: 16px; }
.ad-slot--bottom { margin-bottom: 16px; }
.ad-slot-inner {
  height: 80px; background: var(--bg-card);
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
  transition: background 0.3s, border-color 0.3s;
  overflow: hidden;
}
.ad-slot-inner img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ===== Layout ===== */
.layout {
  max-width: 1400px; margin: 16px auto; padding: 0 24px;
  display: flex; gap: 20px; align-items: flex-start;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  position: sticky; top: calc(var(--header-height) + 16px);
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}
.cat-nav { padding: 8px 0; }
.cat-item a {
  display: block; padding: 10px 20px; font-size: 14px;
  color: var(--text-secondary); border-left: 3px solid transparent;
  transition: color 0.2s, background 0.2s;
}
.cat-item a:hover { color: var(--primary); background: var(--primary-light); }
.cat-item.active a {
  color: var(--primary); background: var(--primary-light);
  font-weight: 600; border-left-color: var(--primary);
}

/* ===== Content ===== */
.content { flex: 1; min-width: 0; }
.cat-section { margin-bottom: 32px; }
.cat-section-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.cat-section-title::before {
  content: ''; display: inline-block;
  width: 4px; height: 16px;
  background: var(--primary); border-radius: 2px;
}

/* ===== Cards Grid ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* ===== Site Card ===== */
.site-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  position: relative; overflow: hidden; text-decoration: none;
}
.site-card:hover {
  box-shadow: var(--shadow-hover); border-color: var(--primary);
  transform: translateY(-2px);
}
.site-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; flex-shrink: 0; background: var(--bg);
}
.site-icon-fallback {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.site-info { flex: 1; min-width: 0; }
.site-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.site-desc {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty;
}
.site-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; line-height: 1.4; }
.badge--hot { background: #FF4D4F; color: #fff; }
.badge--new { background: #52C41A; color: #fff; }

/* ===== Detail Page ===== */
.detail-wrap { max-width: 1400px; margin: 0px auto; padding: 0 24px; }
.detail-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  display: flex; gap: 24px; align-items: flex-start;
  transition: background 0.3s, border-color 0.3s;
}
.detail-icon { width: 80px; height: 80px; border-radius: 16px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.detail-icon-fallback {
  width: 80px; height: 80px; border-radius: 16px;
  background: var(--primary-light); color: var(--primary);
  font-size: 36px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.detail-info { flex: 1; }
.detail-name {
  font-size: 24px; font-weight: 700; color: var(--text);
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.detail-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 20px; text-wrap: pretty; }
.detail-visit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; background: var(--primary); color: #fff;
  border-radius: 8px; font-size: 14px; font-weight: 600; transition: background 0.2s;
}
.detail-visit:hover { background: var(--primary-hover); }

/* ===== Recommend Section ===== */
.recommend-section { max-width: 1400px; margin: 0 auto 32px; padding: 0 24px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }

/* ===== Breadcrumb ===== */
.breadcrumb { flex: 1; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== Footer ===== */
.footer { background: var(--bg-card); border-top: 1px solid var(--border); margin-top: 32px; transition: background 0.3s, border-color 0.3s; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.footer-icp, .footer-contact, .footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-contact a { color: var(--primary); }
.footer-contact a:hover { color: var(--primary-hover); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout { flex-direction: column; padding: 0 12px; }
  .sidebar { width: 100%; position: static; }
  .cat-list { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; gap: 4px; }
  .cat-item a { padding: 6px 14px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
  .cat-item.active a { border-left: none; border-bottom-color: var(--primary); }
  .header-inner { padding: 0 12px; }
  .search-wrap { max-width: none; }
  .ad-slot, .recommend-section, .detail-wrap { padding: 0 12px; }
  .detail-layout { flex-direction: column; padding: 0 12px; }
  .detail-sidebar { width: 100%; position: static; flex-direction: row; }
  .ad-slot-side .ad-slot-inner { height: 80px; writing-mode: horizontal-tb; letter-spacing: normal; }
  .detail-card { flex-direction: column; padding: 20px; }
  .detail-info { padding-right: 0; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .footer-inner { padding: 16px 12px; }
}

/* ===== Content ===== */
.content { flex: 1; min-width: 0; }
.cat-section { margin-bottom: 32px; }
.cat-section-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.cat-section-title::before {
  content: ''; display: inline-block;
  width: 4px; height: 16px;
  background: var(--primary); border-radius: 2px;
}

/* ===== Cards Grid ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 14px; }

/* ===== Site Card ===== */
.site-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  position: relative; overflow: hidden; text-decoration: none;
}
.site-card:hover { box-shadow: var(--shadow-hover); border-color: var(--primary); transform: translateY(-2px); }
.site-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; background: var(--bg); }
.site-icon-fallback {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.site-info { flex: 1; min-width: 0; }
.site-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-desc {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-wrap: pretty;
}
.site-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; line-height: 1.4; }
.badge--hot { background: #FF4D4F; color: #fff; }
.badge--new { background: #52C41A; color: #fff; }

/* ===== Detail Page ===== */
.detail-layout {
  max-width: 1400px; margin: 24px auto; padding: 0 24px;
  display: flex; gap: 20px; align-items: flex-start;
}
.detail-main { flex: 1; min-width: 0; }
.detail-wrap { margin-bottom: 20px; }
.detail-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  display: flex; gap: 24px; align-items: flex-start;
  position: relative;
  transition: background 0.3s, border-color 0.3s;
}
.detail-views {
  position: absolute; top: 16px; right: 16px;
  font-size: 13px; font-weight: 600;
  color: var(--primary);
  display: flex; align-items: center; gap: 6px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  padding: 5px 12px; border-radius: 20px;
  line-height: 1;
}
.detail-views-num { font-size: 15px; font-weight: 700; }
.detail-views-icon { font-size: 14px; }
.detail-icon { width: 80px; height: 80px; border-radius: 16px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.detail-icon-fallback {
  width: 80px; height: 80px; border-radius: 16px;
  background: var(--primary-light); color: var(--primary);
  font-size: 36px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.detail-info { flex: 1; padding-right: 80px; }
.detail-name {
  font-size: 24px; font-weight: 700; color: var(--text);
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.detail-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 20px; text-wrap: pretty; }
.detail-visit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; background: var(--primary); color: #fff;
  border-radius: 8px; font-size: 14px; font-weight: 600; transition: background 0.2s;
}
.detail-visit:hover { background: var(--primary-hover); }

/* ===== Detail About ===== */
.detail-about {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-top: 16px;
  transition: background 0.3s, border-color 0.3s;
}
.detail-about-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.detail-about-title::before {
  content: ''; display: inline-block;
  width: 4px; height: 15px; background: var(--primary); border-radius: 2px;
}
.detail-about-text {
  font-size: 14px; color: var(--text-secondary); line-height: 1.9;
  text-wrap: pretty; margin-bottom: 16px;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail-meta-item { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.detail-meta-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px;
}
.detail-meta-item a { color: var(--primary); word-break: break-all; }
.detail-meta-item a:hover { color: var(--primary-hover); }

/* ===== Detail Sidebar (ads) ===== */
.detail-sidebar {
  width: 160px; flex-shrink: 0;
  position: sticky; top: calc(var(--header-height) + 16px);
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - var(--header-height) - 32px);
  overflow-y: auto;
}
/* 统一尺寸 160×240，PC/手机共用同一张图 */
.ad-slot-side {
  width: 160px; height: 240px; flex-shrink: 0;
  border-radius: var(--radius); overflow: hidden;
  border: 1.5px dashed var(--border);
  background: var(--bg-card);
  transition: border-color 0.3s, background 0.3s;
  display: block;
}
.ad-slot-side img {
  width: 160px; height: 240px;
  object-fit: cover; display: block;
}
/* 无图时的占位 */
.ad-slot-side .ad-slot-inner {
  width: 160px; height: 240px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px;
  writing-mode: vertical-rl; letter-spacing: 4px;
}

/* ===== Recommend Section ===== */
.recommend-section { max-width: 1400px; margin: 0 auto 32px; padding: 0 24px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }

/* ===== Breadcrumb ===== */
.breadcrumb { flex: 1; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== Footer ===== */
.footer { background: var(--bg-card); border-top: 1px solid var(--border); margin-top: 32px; transition: background 0.3s, border-color 0.3s; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.footer-icp, .footer-contact, .footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-contact a { color: var(--primary); }
.footer-contact a:hover { color: var(--primary-hover); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .top-nav-inner { padding: 0 12px; }
  .layout { flex-direction: column; padding: 0 12px; }
  .sidebar { width: 100%; position: static; }
  .cat-list { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; gap: 4px; }
  .cat-item a { padding: 6px 14px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
  .cat-item.active a { border-left: none; border-bottom-color: var(--primary); }
  .header-inner { padding: 0 12px; }
  .search-wrap { max-width: none; }
  .ad-slot, .recommend-section { padding: 0 12px; }

  /* 详情页：右侧广告栏移到主内容下方，横向滚动 */
  .detail-layout { flex-direction: column; padding: 0 12px; }
  .detail-sidebar {
    width: 100%; position: static;
    flex-direction: row; overflow-x: auto; overflow-y: visible;
    max-height: none; gap: 12px;
    padding-bottom: 4px;
  }
  /* 手机端广告与 PC 端保持同一尺寸 160×240 */
  .ad-slot-side { flex-shrink: 0; }
  .ad-slot-side .ad-slot-inner {
    writing-mode: horizontal-tb; letter-spacing: normal;
  }

  .detail-card { flex-direction: column; padding: 16px; }
  .detail-info { padding-right: 0; }
  .detail-views { top: 12px; right: 12px; font-size: 11px; padding: 4px 9px; }
  .detail-views-num { font-size: 13px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .footer-inner { padding: 16px 12px; }
}
