:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-hover: #cbd5e1;
  --radius: 9px;
  --container: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.container {
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto;
}

.hero {
  padding: 28px 0 18px;
}

.hero-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 760;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  flex: none;
  padding-bottom: 2px;
  color: var(--text-secondary);
  font-size: 12.5px;
  white-space: nowrap;
}

.stats strong {
  color: var(--text);
  font-weight: 650;
}

.category-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  border-top: 1px solid rgba(229, 231, 235, 0.75);
  border-bottom: 1px solid rgba(229, 231, 235, 0.95);
  background: rgba(247, 248, 250, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.category-bar {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 560;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.category-link:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: #fff;
}

main {
  padding: 24px 0 44px;
}

.category-section + .category-section {
  margin-top: 24px;
}

.category-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.category-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.category-count {
  color: var(--text-tertiary);
  font-size: 11.5px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.bookmark-card {
  display: block;
  min-width: 0;
  min-height: 66px;
  padding: 11px 13px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.bookmark-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  background: #fff;
}

.bookmark-name {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.4;
  letter-spacing: -0.012em;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-description {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 44px 24px;
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text-secondary);
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
}

footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 26px;
  color: var(--text-tertiary);
  font-size: 11.5px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

@media (max-width: 980px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .hero {
    padding: 24px 0 16px;
  }

  .hero-inner {
    display: block;
  }

  .stats {
    margin-top: 10px;
  }

  main {
    padding-top: 20px;
  }

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

  .footer-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
