/* ========================================
   游戏机改装 - 维基知识库风格样式
   主色调: #7c6a46
   ======================================== */

/* CSS 变量 */
:root {
  --primary: #7c6a46;
  --primary-dark: #5d4f35;
  --primary-light: #9a8560;
  --bg-main: #f8f6f3;
  --bg-card: #ffffff;
  --bg-sidebar: #f5f3ef;
  --text-main: #333333;
  --text-secondary: #666666;
  --text-muted: #888888;
  --border: #e0dcd5;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

/* 重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-main);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   布局容器
   ======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.page-wrapper {
  display: flex;
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
}

/* ========================================
   页头
   ======================================== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  padding: 8px 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
}

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

.header-search {
  position: relative;
  width: 280px;
}

.header-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-main);
  font-size: 0.9375rem;
  transition: all 0.2s;
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.header-search::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  opacity: 0.6;
}

/* ========================================
   Hero 区域
   ======================================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-desc {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 24px 16px 52px;
  border: none;
  border-radius: 32px;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.hero-search input:focus {
  outline: none;
}

.hero-search::before {
  content: "🔍";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
}

/* ========================================
   卡片组件
   ======================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

/* ========================================
   分类网格
   ======================================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.category-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.category-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.category-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-sidebar);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 1.5rem;
}

.category-item:hover .category-icon {
  background: var(--primary);
}

.category-name {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.category-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========================================
   文章列表
   ======================================== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.article-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.article-thumb {
  width: 120px;
  height: 80px;
  background: var(--bg-sidebar);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.article-info {
  flex: 1;
  min-width: 0;
}

.article-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
}

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

.article-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========================================
   侧边栏组件
   ======================================== */
.sidebar-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-list a:last-child {
  border-bottom: none;
}

.sidebar-list a:hover {
  color: var(--primary);
}

.sidebar-list a::before {
  content: "•";
  color: var(--primary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-sidebar);
  border-radius: 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tag:hover {
  background: var(--primary);
  color: #fff;
}

/* ========================================
   面包屑
   ======================================== */
.breadcrumb {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.breadcrumb-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span {
  margin: 0 8px;
  color: var(--border);
}

/* ========================================
   文章正文
   ======================================== */
.article-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.3;
}

.article-page-meta {
  display: flex;
  gap: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.article-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-main);
}

.article-body h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--primary-dark);
}

.article-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-main);
}

.article-body p {
  margin-bottom: 16px;
}

.article-body ul,
.article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-body ul li {
  list-style: disc;
  margin-bottom: 8px;
}

.article-body ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

.article-body strong {
  color: var(--primary-dark);
}

.info-box {
  background: var(--bg-sidebar);
  border-left: 4px solid var(--primary);
  padding: 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}

.info-box-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ========================================
   目录
   ======================================== */
.toc {
  background: var(--bg-sidebar);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 88px;
}

.toc-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.toc-list {
  font-size: 0.875rem;
}

.toc-list li {
  margin-bottom: 8px;
}

.toc-list a {
  color: var(--text-secondary);
  display: block;
  padding: 4px 0;
}

.toc-list a:hover {
  color: var(--primary);
}

.toc-list ul {
  padding-left: 16px;
  margin-top: 4px;
}

/* ========================================
   三栏布局 (推荐/热门/最新)
   ======================================== */
.three-col-section {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.col-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.col-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.col-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  padding: 6px 0;
}

.col-list a:hover {
  color: var(--primary);
}

.col-list a::before {
  content: "›";
  color: var(--primary);
  font-weight: bold;
}

/* ========================================
   页脚
   ======================================== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
}

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

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========================================
   404 页面
   ======================================== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.3;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.error-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-main);
}

/* ========================================
   分页
   ======================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

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

.pagination .current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========================================
   分类页头部
   ======================================== */
.category-header {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
}

.category-header-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 2rem;
}

.category-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.category-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========================================
   子分类
   ======================================== */
.subcategory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.subcategory-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-sidebar);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.subcategory-item:hover {
  background: var(--primary);
  color: #fff;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
  .page-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .three-col-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .header-search {
    width: 100%;
    order: 2;
  }

  .hero {
    padding: 40px 16px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-desc {
    font-size: 1rem;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-item {
    flex-direction: column;
  }

  .article-thumb {
    width: 100%;
    height: 160px;
  }

  .three-col-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .error-code {
    font-size: 5rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .category-stats {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  .article-page-title {
    font-size: 1.375rem;
  }
}
