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

:root {
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8e8ea0;
  --accent: #4f6ef7;
  --accent-light: #eef1fe;
  --border: #e8e8ed;
  --hover-bg: #f7f8fa;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

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

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

a {
  text-decoration: none;
  color: inherit;
}

/* ========== 页面布局 ========== */
.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ========== 页头 ========== */
.page-header {
  text-align: center;
  padding: 40px 0 32px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-header p {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========== 搜索栏 ========== */
.search-bar {
  position: relative;
  max-width: 480px;
  margin: 0 auto 32px;
}

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

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

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

.search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ========== 分类区块 ========== */
.category-section {
  margin-bottom: 28px;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

/* ========== 链接网格 ========== */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
}

.link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.link-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

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

.link-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ========== 底部 ========== */
.page-footer {
  text-align: center;
  padding: 24px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.page-footer a {
  color: var(--accent);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .page-header {
    padding: 24px 0 20px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    margin-bottom: 24px;
  }

  .category-section {
    margin-bottom: 20px;
  }
}
