:root {
  --bg: #f3f5f9;
  --bg-soft: #e9edf4;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #9333ea;
  --header-bg: rgba(255, 255, 255, 0.85);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --max-width: 1080px;
}

[data-theme="dark"] {
  --bg: #0f1420;
  --bg-soft: #151c2c;
  --card-bg: #1b2436;
  --card-border: #2a3550;
  --text: #e6e9f0;
  --muted: #94a3b8;
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --accent: #a78bfa;
  --header-bg: rgba(15, 20, 32, 0.85);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== 顶栏 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  min-height: 60px;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-soft);
}

.logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.site-name {
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav .nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.header-nav .nav-link:hover,
.header-nav .nav-link.active {
  color: var(--primary);
  background: var(--bg-soft);
}

.header-nav .nav-blog-btn {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.header-nav .nav-blog-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.header-nav .nav-blog-btn.active {
  filter: brightness(1.12);
  box-shadow: 0 0 0 3px var(--bg-soft), 0 6px 16px rgba(0, 0, 0, 0.24);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s, transform 0.2s;
}

.theme-toggle:hover {
  transform: rotate(15deg);
}

/* ===== 首页主体 ===== */
.hero {
  text-align: center;
  padding: 40px 0 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.hero p {
  margin: 0 auto;
  max-width: 640px;
  color: var(--muted);
}

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

.search-box input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-box .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-engine-group {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.search-engine-group .engine-btn {
  padding: 3px 14px;
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.search-engine-group .engine-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.search-engine-group .engine-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
}

.search-results {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 2px);
  width: 100%;
  max-height: 340px;
  overflow-y: auto;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 200;
  display: none;
}

.search-results .sr-group {
  padding: 6px 14px 2px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.search-results .sr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 6px;
}

.search-results .sr-item:hover {
  background: var(--bg-soft);
  color: var(--primary);
}

.search-results .sr-item .sr-desc {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 560px) {
  .search-results {
    width: calc(100vw - 24px);
  }
}

.section {
  padding: 16px 0 40px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 16px;
}

.link-group {
  margin-bottom: 28px;
}

.link-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary, #6366f1);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.link-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 16px;
  min-height: 92px;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease;
  overflow: hidden;
  position: relative;
}

.link-btn .link-cta {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  font-size: 0.6rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 0 var(--radius) 0 10px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* 引导标签：顶部色带 */
.link-btn .link-cta.cta-ribbon {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 0;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* 引导标签：图标 + 文字 */
.link-btn .link-cta.cta-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 999px;
  padding: 4px 8px 4px 6px;
}

/* 引导标签：描边小字 */
.link-btn .link-cta.cta-outline {
  top: auto;
  right: 6px;
  bottom: 6px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--card-border);
  padding: 2px 6px;
}

.link-btn .btn-title {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.link-btn .btn-text {
  font-size: 0.82rem;
  opacity: 0.85;
  line-height: 1.4;
  word-break: break-word;
}

.link-btn:active {
  transform: scale(0.97);
}

/* ===== 按钮排列方式 ===== */
.link-grid.layout-grid3 {
  grid-template-columns: repeat(3, 1fr);
}

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

.link-grid.layout-grid4 {
  grid-template-columns: repeat(4, 1fr);
}

.link-grid.layout-grid1 {
  grid-template-columns: 1fr;
}

.link-grid.layout-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.link-grid.layout-flow .link-btn {
  flex: 1 1 220px;
  max-width: 320px;
}

/* ===== 前端整体配色风格 ===== */
[data-site-style="nature"] {
  --primary: #16a34a;
  --primary-hover: #15803d;
  --accent: #0d9488;
  --bg: #f2f7ef;
  --bg-soft: #e7f0e3;
  --card-bg: #ffffff;
  --card-border: #dbe7d6;
}

[data-theme="dark"][data-site-style="nature"] {
  --primary: #4ade80;
  --primary-hover: #22c55e;
  --accent: #2dd4bf;
  --bg: #0e1710;
  --bg-soft: #15221a;
  --card-bg: #16231b;
  --card-border: #24392c;
}

[data-site-style="tech"] {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #6366f1;
  --bg: #eff8fd;
  --bg-soft: #e2f0f9;
  --card-bg: #ffffff;
  --card-border: #cfe3f0;
}

[data-theme="dark"][data-site-style="tech"] {
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --accent: #818cf8;
  --bg: #0b1520;
  --bg-soft: #11202f;
  --card-bg: #122233;
  --card-border: #1f3a52;
}

[data-site-style="warm"] {
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --accent: #f59e0b;
  --bg: #fdf5ee;
  --bg-soft: #f9eadd;
  --card-bg: #ffffff;
  --card-border: #f0dcc9;
}

[data-theme="dark"][data-site-style="warm"] {
  --primary: #fb923c;
  --primary-hover: #f97316;
  --accent: #fbbf24;
  --bg: #191006;
  --bg-soft: #24180c;
  --card-bg: #251709;
  --card-border: #3d2a12;
}

[data-site-style="ink"] {
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --accent: #8b5cf6;
  --bg: #0f1522;
  --bg-soft: #171f31;
  --card-bg: #1b2436;
  --card-border: #2a3550;
  --text: #e6e9f0;
  --muted: #94a3b8;
}

[data-theme="dark"][data-site-style="ink"] {
  --primary: #38bdf8;
  --accent: #a78bfa;
  --bg: #0a0f1a;
  --bg-soft: #121826;
}

/* ===== 背景层 ===== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-layer .bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.2s ease, transform 1.2s ease;
  will-change: opacity, transform;
}

.bg-layer .bg-slide.active {
  opacity: var(--bg-opacity, 0.6);
}

.bg-layer[data-effect="slide"] .bg-slide {
  transform: translateX(100%);
}

.bg-layer[data-effect="slide"] .bg-slide.active {
  transform: translateX(0);
}

.bg-layer[data-effect="zoom"] .bg-slide {
  transform: scale(1);
}

.bg-layer[data-effect="zoom"] .bg-slide.active {
  transform: scale(1.05);
}

/* ===== 按钮风格 1：渐变活力 ===== */
.link-grid.style1 .link-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: var(--shadow);
}

.link-grid.style1 .link-btn:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ===== 按钮风格 2：经典扁平 ===== */
.link-grid.style2 .link-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.link-grid.style2 .link-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ===== 按钮风格 3：胶囊圆润 ===== */
.link-grid.style3 .link-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 999px;
}

.link-grid.style3 .link-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ===== 按钮风格 4：描边简洁 ===== */
.link-grid.style4 .link-btn {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
}

.link-grid.style4 .link-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ===== 按钮风格 5：玻璃拟态 ===== */
.link-grid.style5 .link-btn {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

[data-theme="dark"] .link-grid.style5 .link-btn {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

.link-grid.style5 .link-btn:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .link-grid.style5 .link-btn:hover {
  background: rgba(30, 41, 59, 0.8);
}

/* ===== 按钮风格 6：卡片投影 ===== */
.link-grid.style6 .link-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.link-grid.style6 .link-btn:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* ===== 按钮风格 7：细镂空边框 ===== */
.link-grid.style7 .link-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
}

.link-grid.style7 .link-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(79, 70, 229, 0.35);
}

/* ===== 按钮风格 8：圆角镂空 ===== */
.link-grid.style8 .link-btn {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
}

.link-grid.style8 .link-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(147, 51, 234, 0.35);
}

/* ===== 按钮风格 9：渐变镂空 ===== */
.link-grid.style9 .link-btn {
  background: transparent;
  color: var(--primary);
  border: 2px solid transparent;
  border-radius: 12px;
  background-image: linear-gradient(var(--bg), var(--bg)),
    linear-gradient(135deg, var(--primary), var(--accent));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.link-grid.style9 .link-btn:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.3));
}

/* ===== 按钮风格 10：细描边悬浮高亮 ===== */
.link-grid.style10 .link-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

.link-grid.style10 .link-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ===== 博客页 ===== */
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 28px 0 20px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.article-card .cover {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--bg-soft);
}

.article-card .no-cover {
  width: 100%;
  height: 150px;
  background: linear-gradient(135deg, var(--bg-soft), var(--card-border));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--muted);
}

.article-card .body {
  padding: 16px;
  flex: 1;
}

.article-card .body h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .meta {
  padding: 10px 16px;
  border-top: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 28px 0 40px;
}

.pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 文章详情 ===== */
.article-detail {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 28px 0 40px;
  box-shadow: var(--shadow);
}

.article-detail h1 {
  font-size: 1.7rem;
  margin: 0 0 10px;
  line-height: 1.4;
  word-break: break-word;
}

.article-detail .meta {
  color: var(--muted);
  font-size: 0.85rem;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 20px;
}

.article-content {
  font-size: 1rem;
  line-height: 1.9;
  word-break: break-word;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote,
.article-content pre,
.article-content table {
  margin: 0 0 16px;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  margin: 24px 0 12px;
  line-height: 1.4;
}

.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 8px 16px;
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

.article-content code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  word-break: break-all;
}

.article-content pre {
  background: var(--bg-soft);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  max-width: 100%;
}

.article-content pre code {
  background: none;
  padding: 0;
  word-break: normal;
}

.article-content table {
  border-collapse: collapse;
  width: 100%;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.article-content th,
.article-content td {
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  text-align: left;
}

.article-content a {
  word-break: break-all;
}

/* ===== 页脚 ===== */
.site-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 22px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 32px;
  background: transparent;
  border-top: 1px solid transparent;
  border-image: linear-gradient(
      90deg,
      transparent,
      rgba(148, 163, 184, 0.45),
      rgba(99, 102, 241, 0.45),
      rgba(168, 85, 247, 0.35),
      transparent
    )
    1;
}

.site-footer::before {
  content: "";
  display: block;
  width: 180px;
  height: 1px;
  margin: 0 auto 20px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(148, 163, 184, 0.4),
    transparent
  );
}

.site-footer .footer-links {
  margin-bottom: 8px;
}

.site-footer .footer-links a {
  color: var(--muted);
  text-decoration: none;
  margin: 0 8px;
}

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

.icp-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
}

.icp-text:hover {
  color: var(--primary);
}

.icp-text img {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

/* ===== 友链页面 ===== */
.friends-head {
  padding: 20px 0 8px;
  text-align: center;
}

.friends-desc {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 6px 0 0;
}

.friend-announcement {
  margin: 18px auto 6px;
  max-width: 860px;
  padding: 14px 18px;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.7;
  word-break: break-word;
}

.friend-announcement a {
  color: var(--primary);
}

.friend-group {
  margin: 22px 0;
}

.friend-group-recommend {
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-soft), var(--card-bg));
}

.friend-group-recommend .friend-group-head h3 {
  color: var(--primary);
  font-size: 1.1rem;
}

.friend-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.friend-group-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.friend-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
  overflow: hidden;
}

.friend-group-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.friend-list.layout-grid2 {
  grid-template-columns: repeat(2, 1fr);
}

.friend-list.layout-grid4 {
  grid-template-columns: repeat(4, 1fr);
}

.friend-list.layout-grid1 {
  grid-template-columns: 1fr;
}

.friend-list.layout-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.friend-list.layout-flow .friend-card {
  flex: 1 1 220px;
  max-width: 340px;
}

.friend-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
  min-width: 0;
}

.friend-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}


.friend-top {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 0 0 0 8px;
}

.friend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  flex-shrink: 0;
  overflow: hidden;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.friend-icon img {
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.friend-icon.no-icon {
  text-indent: 0;
  color: var(--primary);
  font-size: 1rem;
}

.friend-name {
  font-size: 0.88rem;
  font-weight: 600;
  word-break: break-word;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.friend-card .friend-desc {
  margin-left: auto;
  max-width: 55%;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-list.friend-view-list {
  display: block;
}

.friend-list.friend-view-list .friend-card {
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 16px;
}

@media (max-width: 560px) {
  .friend-card .friend-desc {
    max-width: 45%;
  }
}


/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .link-grid,
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .friend-list.layout-flow .friend-card {
    flex-basis: 160px;
  }

  .link-grid.layout-grid1 {
    grid-template-columns: 1fr;
  }

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

  .link-grid.layout-flow .link-btn {
    flex-basis: 160px;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 12px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .site-name {
    font-size: 1.05rem;
  }

  .header-nav .nav-link {
    padding: 6px 8px;
    font-size: 0.88rem;
  }

  .link-grid,
  .article-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .friend-list {
    gap: 10px;
  }


  .friend-list.layout-flow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .friend-list.layout-flow .friend-card {
    flex: 1 1 auto;
    max-width: none;
  }

  .link-btn {
    min-height: 80px;
    padding: 18px 14px;
  }

  .article-detail {
    padding: 20px;
  }

  .article-detail h1 {
    font-size: 1.35rem;
  }
}

@media (max-width: 380px) {
  .logo-img,
  .logo-placeholder {
    width: 32px;
    height: 32px;
  }

  .site-name {
    max-width: 120px;
  }

  .header-nav .nav-link {
    display: none;
  }

  .header-nav .nav-link:first-child,
  .header-nav .nav-link:last-child {
    display: inline-block;
  }
}

/* ===== 友链提交表单 ===== */
.friend-submit {
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  background: var(--card-bg, rgba(255, 255, 255, 0.8));
}
[data-theme="dark"] .friend-submit {
  background: var(--card-bg, rgba(30, 30, 40, 0.8));
}
.friend-submit-toggle {
  display: block;
  margin: 0 auto;
  padding: 12px 28px;
  font-size: 15px;
  border: 1px dashed var(--primary, #4a6cf7);
  color: var(--primary, #4a6cf7);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.friend-submit-toggle:hover {
  background: var(--primary, #4a6cf7);
  color: #fff;
}
.friend-submit-toggle.open {
  border-style: solid;
}
.friend-submit-body {
  margin-top: 20px;
}
.friend-submit-head {
  margin-bottom: 18px;
}
.friend-submit-title {
  margin: 0 0 6px;
  font-size: 18px;
}
.friend-submit-desc {
  margin: 0;
  font-size: 13px;
  opacity: 0.7;
}
.friend-submit-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.friend-submit-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-submit-form .form-row label {
  font-size: 13px;
  font-weight: 600;
}
.friend-submit-form .form-row label em {
  color: #e0245e;
  font-style: normal;
}
.friend-submit-form .form-row label .sub {
  font-weight: 400;
  opacity: 0.6;
  margin-left: 4px;
}
.friend-submit-form .form-row input[type="text"],
.friend-submit-form .form-row input[type="url"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 8px;
  font-size: 14px;
  background: var(--input-bg, #fff);
  color: inherit;
  outline: none;
}
.friend-submit-form .form-row input:focus {
  border-color: var(--primary, #4a6cf7);
}
[data-theme="dark"] .friend-submit-form .form-row input {
  background: rgba(255, 255, 255, 0.06);
}
.input-with-btn {
  display: flex;
  gap: 8px;
}
.input-with-btn input {
  flex: 1;
}
.auto-fetch-btn {
  white-space: nowrap;
  padding: 0 14px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
}
.auto-fetch-btn:hover {
  border-color: var(--primary, #4a6cf7);
  color: var(--primary, #4a6cf7);
}
.auto-fetch-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.friend-submit-form .hint {
  font-size: 12px;
  opacity: 0.7;
  min-height: 16px;
}
.friend-submit-form .hint.fetch-ok {
  color: #16a34a;
  opacity: 1;
}
.friend-submit-form .hint.fetch-error {
  color: #e0245e;
  opacity: 1;
}
.friend-submit-form .form-actions {
  margin-top: 20px;
}
.friend-submit-form .btn.primary {
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  background: var(--primary, #4a6cf7);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.friend-submit-form .btn.primary:hover {
  opacity: 0.9;
}
.friend-submit-form .btn.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (max-width: 640px) {
  .friend-submit-form .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 界面模板 ===== */
/* 经典白：使用默认变量，无需额外样式 */

/* 玻璃拟态 */
.tpl-glass .site-header {
  background: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"].tpl-glass .site-header {
  background: rgba(15, 20, 32, 0.55);
}
.tpl-glass .hero {
  padding: 48px 0 32px;
}
.tpl-glass .search-box {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.5);
}
[data-theme="dark"].tpl-glass .search-box {
  background: rgba(27, 36, 54, 0.5);
}

/* 卡片杂志 */
.tpl-magazine .link-group {
  margin-bottom: 30px;
}
.tpl-magazine .link-group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 8px 18px 8px 12px;
  background: var(--card-bg);
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.tpl-magazine .link-btn {
  border-radius: 18px;
  border: 1px solid var(--card-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.tpl-magazine .link-btn:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

/* 暗黑科技 */
.tpl-dark .hero h1 {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tpl-dark .link-btn {
  border: 1px solid var(--card-border);
}

/* 清新自然 */
.tpl-fresh .hero h1 {
  color: var(--primary);
}
.tpl-fresh .link-group-title {
  color: var(--primary);
  font-weight: 700;
}
.tpl-fresh .link-btn {
  border: 1px solid rgba(22, 163, 74, 0.18);
}

/* 紫色渐变夜 */
.tpl-purple .hero h1 {
  background: linear-gradient(135deg, #a78bfa, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tpl-purple .header-nav .nav-blog-btn {
  background: linear-gradient(135deg, #a78bfa, #ec4899);
}
.tpl-purple .link-btn {
  border: 1px solid rgba(167, 139, 250, 0.28);
}
.tpl-purple .link-btn:hover {
  border-color: #a78bfa;
  box-shadow: 0 6px 20px rgba(167, 139, 250, 0.35);
}

/* 极简黑白 */
.tpl-minimal .site-header {
  background: rgba(255, 255, 255, 0.92);
}
[data-theme="dark"].tpl-minimal .site-header {
  background: rgba(15, 20, 32, 0.92);
}
.tpl-minimal .link-btn {
  box-shadow: none;
  border-radius: 8px;
}
.tpl-minimal .link-btn:hover {
  box-shadow: none;
  border-color: var(--text);
}
.tpl-minimal .link-group-title {
  letter-spacing: 4px;
  text-transform: uppercase;
}
.tpl-minimal .hero h1 {
  font-weight: 300;
  letter-spacing: 2px;
}
