:root {
  --s1: #2176AE;
  --s2: #C1121F;
  --s3: #780000;
  --s4: #E65100;
  --s5: #2E7D32;
  --s6: #6B3FA0;
  --s7: #00838F;
  --s8: #4527A0;
  --s9: #AD1457;
  --s10: #1565C0;
  --s11: #00695C;
  --s12: #4527A0;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #6c757d;
  --border: #dee2e6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, #2176AE, #6B3FA0);
  z-index: 9999;
  transition: width 0.1s;
  width: 0;
}

/* ===== 通用头部 ===== */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 200px;
}
.site-logo .logo-icon { font-size: 1.2rem; flex-shrink: 0; }
.site-logo .logo-text { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; }
.header-nav a {
  color: rgba(255,255,255,.75);
  font-size: 0.78rem;
  padding: 5px 8px;
  border-radius: 4px;
  transition: all .2s;
  white-space: nowrap;
}
.header-nav a:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.header-nav a.active { background: rgba(255,255,255,.25); color: #fff; font-weight: 600; }

/* ===== Hero 区域 ===== */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #fff;
  padding: 40px 16px 32px;
  text-align: center;
}
.hero-icon { font-size: 2rem; margin-bottom: 8px; }
.hero-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; letter-spacing: .5px; }
.hero-sub { font-size: 0.82rem; color: rgba(255,255,255,.7); margin-bottom: 20px; line-height: 1.5; }
.hero-stats { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { font-size: 1.4rem; font-weight: 700; color: #4fc3f7; }
.stat-label { font-size: 0.7rem; color: rgba(255,255,255,.6); margin-top: 2px; }

/* ===== 主页主内容区 ===== */
.main { max-width: 1400px; margin: 0 auto; padding: 24px 16px 60px; }

/* 网格布局 - 统一高度 */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}
.series-column {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}
.series-column.home-mode .series-header { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px; }
.series-column.home-mode .series-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.series-column.home-mode .series-desc { font-size: 0.8rem; opacity: .8; line-height: 1.4; max-width: 90%; }

.series-header { padding: 16px; color: #fff; cursor: pointer; position: relative; transition: transform 0.2s, box-shadow 0.2s; min-height: 88px; }
.series-header:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.series-header::after { content: '进入 →'; position: absolute; right: 14px; bottom: 14px; font-size: 0.7rem; opacity: 0.8; background: rgba(255,255,255,0.2); padding: 3px 10px; border-radius: 4px; }
.series-header.s1 { background: linear-gradient(135deg, #2176AE, #1a5a8a); }
.series-header.s2 { background: linear-gradient(135deg, #C1121F, #8a0c15); }
.series-header.s3 { background: linear-gradient(135deg, #780000, #4a0000); }
.series-header.s4 { background: linear-gradient(135deg, #E65100, #b33d00); }
.series-header.s5 { background: linear-gradient(135deg, #2E7D32, #1b5e1e); }
.series-header.s6 { background: linear-gradient(135deg, #6B3FA0, #4a2a70); }
.series-header.s7 { background: linear-gradient(135deg, #00838F, #005662); }
.series-header.s8 { background: linear-gradient(135deg, #4527A0, #311b6b); }
.series-header.s9 { background: linear-gradient(135deg, #AD1457, #7b0d3e); }
.series-header.s10 { background: linear-gradient(135deg, #1565C0, #0d47a1); }
.series-header.s11 { background: linear-gradient(135deg, #00695C, #004d40); }
.series-header.s12 { background: linear-gradient(135deg, #4527A0, #311B92); }
.series-num { font-size: 0.7rem; opacity: .8; margin-bottom: 3px; }
.series-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.series-desc { font-size: 0.75rem; opacity: .85; line-height: 1.4; }
.series-column.home-mode .article-list { display: none; }

.article-list { padding: 6px; flex: 0 0 auto; }
.article-card {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: 8px; margin-bottom: 6px;
  background: #f8f9fa; transition: all .2s; border: 1px solid transparent;
  min-height: 48px;
}
.article-card:last-child { margin-bottom: 0; }
.article-card:hover { background: var(--surface); border-color: var(--card-color); box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateX(4px); text-decoration: none; }
.card-top { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.card-icon { font-size: 1.2rem; flex-shrink: 0; }
.card-topic { font-size: 0.65rem; color: var(--card-color); font-weight: 600; background: rgba(0,0,0,.04); padding: 2px 6px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.card-title { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 筛选状态 */
.series-column.filtered-out { opacity: 0; transform: scale(0.95); pointer-events: none; position: absolute; visibility: hidden; width: 0; height: 0; overflow: hidden; margin: 0; padding: 0; }
.series-column.filtered-in { opacity: 1; transform: scale(1); }
.masonry-grid.filtered { display: flex; justify-content: center; }
.masonry-grid.filtered .series-column { max-width: 700px; width: 100%; }
.masonry-grid.filtered .series-header { padding: 16px; min-height: 72px; }
.masonry-grid.filtered .series-header::after { display: none; }
.masonry-grid.filtered .article-list { display: block; padding: 8px; }
.masonry-grid.filtered .article-card { padding: 12px; margin-bottom: 6px; }

/* 三列筛选状态 */
.masonry-grid.filtered .series-column { max-width: 1000px; }
.masonry-grid.filtered .article-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px; }
.masonry-grid.filtered .article-card { margin-bottom: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 80px; padding: 12px 14px; }
@media (max-width: 1200px) { .masonry-grid.filtered .article-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .masonry-grid.filtered .article-list { grid-template-columns: 1fr; gap: 8px; padding: 8px; }
  .masonry-grid.filtered .article-card { min-height: 48px; padding: 10px 12px; }
}

/* 搜索框 */
.search-container { max-width: 500px; margin: 0 auto 20px; position: relative; }
.search-input { width: 100%; padding: 10px 18px 10px 40px; border: 2px solid var(--border); border-radius: 25px; font-size: 0.95rem; outline: none; transition: all 0.3s; background: var(--surface); }
.search-input:focus { border-color: #2176AE; box-shadow: 0 0 0 3px rgba(33, 118, 174, 0.1); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-top: 8px; max-height: 400px; overflow-y: auto; display: none; box-shadow: 0 4px 20px rgba(0,0,0,0.15); z-index: 100; }
.search-results.visible { display: block; }
.search-result-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f0f4f8; }
.search-result-title { font-weight: 600; color: var(--text); margin-bottom: 3px; font-size: 0.9rem; }
.search-result-series { font-size: 0.75rem; color: var(--muted); }
.search-no-result { padding: 16px; text-align: center; color: var(--muted); }

/* 移动端 */
.mobile-menu-btn { display: none; background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 1.4rem; padding: 6px 10px; border-radius: 6px; cursor: pointer; line-height: 1; flex-shrink: 0; }
.mobile-nav { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.8); z-index: 1000; opacity: 0; transition: opacity 0.3s; }
.mobile-nav.visible { display: block; opacity: 1; }
.mobile-nav-content { background: #1a1a2e; max-width: 280px; height: 100%; padding: 56px 20px 20px; transform: translateX(-100%); transition: transform 0.3s; overflow-y: auto; }
.mobile-nav.visible .mobile-nav-content { transform: translateX(0); }
.mobile-nav-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; }
.mobile-nav a { display: block; color: rgba(255,255,255,.8); padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.95rem; }
.mobile-nav a:hover { color: #fff; }

/* Footer */
.site-footer { background: #1a1a2e; color: rgba(255,255,255,.6); text-align: center; padding: 24px; font-size: .85rem; margin-top: 60px; }
.site-footer p { margin-bottom: 4px; }
.site-footer p:last-child { margin-bottom: 0; }

/* scroll-margin */
#s1, #s2, #s3, #s4, #s5, #s6, #s7, #s8, #s9, #s10, #s11, #s12 { scroll-margin-top: 80px; }

/* 移动端响应式 */
@media (max-width: 1200px) { .masonry-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; align-items: center; }
  .header-inner { height: 52px; }
  .hero { padding: 36px 14px 28px; }
  .hero-icon { font-size: 1.8rem; }
  .hero-title { font-size: 1.25rem; }
  .masonry-grid { grid-template-columns: 1fr; gap: 16px; }
  .main { padding: 20px 12px 48px; }
  .series-column.home-mode .series-header { min-height: 100px; }
  .series-header::after { display: none; }
  .site-footer { padding: 16px 12px; font-size: 0.75rem; }
  #s1, #s2, #s3, #s4, #s5, #s6, #s7, #s8, #s9, #s10, #s11, #s12 { scroll-margin-top: 70px; }
}
@media (max-width: 400px) { .site-logo { max-width: 110px; } .hero-title { font-size: 1.1rem; } }


/* =====================================================
     文章页专用样式（Article Pages）
  ===================================================== */
.article-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #fff;
  padding: 32px 16px 24px;
  margin-bottom: 0;
  text-align: center;
}
.breadcrumb { font-size: 0.78rem; color: rgba(255,255,255,.6); margin-bottom: 10px; text-align: center; }
.breadcrumb a { color: rgba(255,255,255,.7); }
.breadcrumb a:hover { color: #fff; }
.article-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; letter-spacing: .3px; text-align: center; }
.article-header .meta { font-size: 0.78rem; color: rgba(255,255,255,.55); }

.article-container { max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; }

/* 文章目录 */
.toc-container {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-left: 4px solid #2176AE;
}
.toc-container h2 { font-size: 1rem; margin-bottom: 10px; color: var(--text); }
.toc-container ol { padding-left: 20px; }
.toc-container li { margin-bottom: 5px; font-size: 0.88rem; }
.toc-container a { color: #2176AE; }
.toc-container a:hover { text-decoration: underline; }

/* 文章内容 */
.content { font-size: 0.95rem; }
.content h2 { font-size: 1.15rem; font-weight: 700; color: var(--text); margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 2px solid #e9ecef; }
.content h3 { font-size: 1rem; font-weight: 600; color: #333; margin: 20px 0 10px; }
.content p { margin-bottom: 12px; line-height: 1.8; }
.content ul, .content ol { padding-left: 24px; margin-bottom: 14px; }
.content li { margin-bottom: 6px; line-height: 1.7; }
.content strong { font-weight: 600; color: #333; }
.content code { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-family: Consolas, 'Courier New', monospace; font-size: 0.88em; color: #c7254e; }

/* 表格 */
.content table { width: 100%; border-collapse: collapse; margin-bottom: 18px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.content th { background: linear-gradient(135deg, #2176AE, #1a5a8a); color: #fff; padding: 10px 14px; font-size: 0.85rem; text-align: left; font-weight: 600; }
.content td { padding: 9px 14px; font-size: 0.88rem; border-bottom: 1px solid #eee; line-height: 1.6; }
.content tr:last-child td { border-bottom: none; }
.content tr:hover td { background: #f8f9fc; }

/* 代码块 */
.code-block { background: #1e1e2e; border-radius: 10px; margin-bottom: 18px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #2a2a3e; border-bottom: 1px solid rgba(255,255,255,.08); }
.code-header .lang-label { font-size: 0.75rem; color: rgba(255,255,255,.5); font-family: Consolas, monospace; }
.copy-btn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.7); padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 0.72rem; transition: all 0.2s; }
.copy-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.copy-btn.copied { background: rgba(46,125,50,.6); color: #fff; }
.code-block pre { padding: 16px 18px; overflow-x: auto; font-family: Consolas, 'Courier New', monospace; font-size: 0.85rem; line-height: 1.65; color: #cdd6f4; margin: 0; }
.code-block code { background: transparent !important; color: inherit !important; padding: 0 !important; font-size: inherit !important; }

/* 代码语法高亮 */
.token-cmdlet { color: #89b4fa; }
.token-param { color: #f9e2af; }
.token-string { color: #a6e3a1; }
.token-comment { color: #6c7086; font-style: italic; }
.token-variable { color: #f38ba8; }
.token-number { color: #fab387; }
.token-keyword { color: #cba6f7; }
.token-operator { color: #89dceb; }
.token-type { color: #f9e2af; }

/* 方法切换标签 */
.method-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.method-tab { padding: 7px 16px; border-radius: 6px; border: 2px solid #2176AE; background: transparent; color: #2176AE; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all .2s; }
.method-tab:hover { background: rgba(33,118,174,.08); }
.method-tab.active { background: #2176AE; color: #fff; }
.method-panel { display: none; }
.method-panel.active { display: block; }

/* 步骤 */
.step { display: flex; gap: 12px; margin-bottom: 14px; }
.step-number { width: 26px; height: 26px; background: #2176AE; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.step-content { flex: 1; }
.step-content p { margin-bottom: 6px; font-size: 0.9rem; }
.step-content ul { font-size: 0.88rem; }

/* 提示框 */
.info-box { border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.info-box.info { background: #e8f4fd; border-left: 4px solid #2176AE; }
.info-box.warning { background: #fff8e1; border-left: 4px solid #f57c00; }
.info-box.danger { background: #fdecea; border-left: 4px solid #C1121F; }
.info-box.tip { background: #e8f5e9; border-left: 4px solid #2E7D32; }
.info-box .title { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.info-box p { margin-bottom: 6px; font-size: 0.88rem; }
.info-box p:last-child { margin-bottom: 0; }
.info-box ul, .info-box ol { padding-left: 20px; font-size: 0.88rem; }
.info-box li { margin-bottom: 4px; }
.info-box code { background: rgba(0,0,0,.07); padding: 2px 5px; border-radius: 3px; font-size: 0.88em; }

/* FAQ */
.faq-item { border: 1px solid #e9ecef; border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.faq-question { background: #f8f9fa; padding: 12px 16px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.faq-question:hover { background: #e9ecef; }
.faq-answer { padding: 12px 16px; font-size: 0.88rem; border-top: 1px solid #e9ecef; }
.faq-answer p { margin-bottom: 8px; }
.faq-answer ul, .faq-answer ol { padding-left: 20px; font-size: 0.88rem; }

/* 文章导航 */
.article-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.article-nav a { flex: 1; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; transition: all .2s; max-width: 48%; }
.article-nav a:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.08); text-decoration: none; }
.article-nav .nav-label { font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.article-nav .nav-title { font-weight: 600; font-size: .95rem; }


/* 图片占位 */
.image-placeholder { background: linear-gradient(135deg, #f0f2f5, #e0e4ea); border-radius: 8px; padding: 30px 20px; text-align: center; font-size: 0.82rem; color: var(--muted); margin-bottom: 16px; border: 2px dashed #ccc; }

/* 响应式文章页 */
@media (max-width: 768px) {
  .article-header { padding: 24px 14px 18px; }
  .article-header h1 { font-size: 1.2rem; }
  .article-container { padding: 20px 12px 40px; }
  .toc-container { padding: 14px 16px; }
  .content h2 { font-size: 1.05rem; }
  .content table { font-size: 0.82rem; }
  .content th, .content td { padding: 7px 10px; }
  .method-tabs { flex-wrap: wrap; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
}

/* 移动端导航隐藏 */
.masonry-grid.filtered ~ .search-container,
.search-container.hidden { display: none; }
