/* 素简工具库 · MINIMAL TOOLS — 瑞士极简主义样式表 */
:root {
  color-scheme: light dark;

  --bg-light: #fafafa;
  --bg-dark: #0b0c0e;
  --surface-light: #ffffff;
  --surface-dark: #131518;
  --surface-subtle-light: #f3f4f6;
  --surface-subtle-dark: #1a1d22;
  --border-light: #e5e7eb;
  --border-dark: #242830;
  --border-strong-light: #111827;
  --border-strong-dark: #e5e7eb;
  --text-light: #111827;
  --text-dark: #f3f4f6;
  --muted-light: #6b7280;
  --muted-dark: #9ca3af;
  --faint-light: #9ca3af;
  --faint-dark: #6b7280;
  --ink-btn-bg-light: #111827;
  --ink-btn-bg-dark: #f3f4f6;
  --ink-btn-fg-light: #ffffff;
  --ink-btn-fg-dark: #0b0c0e;
  --header-bg-light: rgba(250, 250, 250, 0.88);
  --header-bg-dark: rgba(11, 12, 14, 0.88);
  --accent-light: #111827;
  --accent-dark: #f3f4f6;
  --star-light: #b45309;
  --star-dark: #fbbf24;
  --scroll-track-light: #f3f4f6;
  --scroll-track-dark: #131518;
  --scroll-thumb-light: #6b7280;
  --scroll-thumb-dark: #8a93a2;

  /* Default (light) tokens for browsers without light-dark() */
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --surface-subtle: var(--surface-subtle-light);
  --border: var(--border-light);
  --border-strong: var(--border-strong-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
  --faint: var(--faint-light);
  --ink-btn-bg: var(--ink-btn-bg-light);
  --ink-btn-fg: var(--ink-btn-fg-light);
  --header-bg: var(--header-bg-light);
  --accent: var(--accent-light);
  --star: var(--star-light);
  --scroll-track: var(--scroll-track-light);
  --scroll-thumb: var(--scroll-thumb-light);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --max-w: 1320px;

  accent-color: var(--accent);
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/* Fallback for browsers without light-dark() */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --surface-subtle: var(--surface-subtle-dark);
    --border: var(--border-dark);
    --border-strong: var(--border-strong-dark);
    --text: var(--text-dark);
    --muted: var(--muted-dark);
    --faint: var(--faint-dark);
    --ink-btn-bg: var(--ink-btn-bg-dark);
    --ink-btn-fg: var(--ink-btn-fg-dark);
    --header-bg: var(--header-bg-dark);
    --accent: var(--accent-dark);
    --star: var(--star-dark);
    --scroll-track: var(--scroll-track-dark);
    --scroll-thumb: var(--scroll-thumb-dark);
  }
}

/* Explicit meta override reflected into CSS color-scheme & fallback tokens */
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
  --bg: var(--bg-dark);
  --surface: var(--surface-dark);
  --surface-subtle: var(--surface-subtle-dark);
  --border: var(--border-dark);
  --border-strong: var(--border-strong-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
  --faint: var(--faint-dark);
  --ink-btn-bg: var(--ink-btn-bg-dark);
  --ink-btn-fg: var(--ink-btn-fg-dark);
  --header-bg: var(--header-bg-dark);
  --accent: var(--accent-dark);
  --star: var(--star-dark);
  --scroll-track: var(--scroll-track-dark);
  --scroll-thumb: var(--scroll-thumb-dark);
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --surface-subtle: var(--surface-subtle-light);
  --border: var(--border-light);
  --border-strong: var(--border-strong-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
  --faint: var(--faint-light);
  --ink-btn-bg: var(--ink-btn-bg-light);
  --ink-btn-fg: var(--ink-btn-fg-light);
  --header-bg: var(--header-bg-light);
  --accent: var(--accent-light);
  --star: var(--star-light);
  --scroll-track: var(--scroll-track-light);
  --scroll-thumb: var(--scroll-thumb-light);
}

/* Progressive enhancement with light-dark() */
@supports (color: light-dark(white, black)) {
  :root {
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --surface-subtle: light-dark(var(--surface-subtle-light), var(--surface-subtle-dark));
    --border: light-dark(var(--border-light), var(--border-dark));
    --border-strong: light-dark(var(--border-strong-light), var(--border-strong-dark));
    --text: light-dark(var(--text-light), var(--text-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --faint: light-dark(var(--faint-light), var(--faint-dark));
    --ink-btn-bg: light-dark(var(--ink-btn-bg-light), var(--ink-btn-bg-dark));
    --ink-btn-fg: light-dark(var(--ink-btn-fg-light), var(--ink-btn-fg-dark));
    --header-bg: light-dark(var(--header-bg-light), var(--header-bg-dark));
    --accent: light-dark(var(--accent-light), var(--accent-dark));
    --star: light-dark(var(--star-light), var(--star-dark));
    --scroll-track: light-dark(var(--scroll-track-light), var(--scroll-track-dark));
    --scroll-thumb: light-dark(var(--scroll-thumb-light), var(--scroll-thumb-dark));
  }
}

/* Legacy scrollbar fallback only when scrollbar-color is unsupported */
@supports not (scrollbar-color: auto) {
  .sidebar-nav::-webkit-scrollbar,
  .mobile-cats::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  .sidebar-nav::-webkit-scrollbar-thumb,
  .mobile-cats::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 999px;
  }
  .sidebar-nav::-webkit-scrollbar-track,
  .mobile-cats::-webkit-scrollbar-track {
    background: var(--scroll-track);
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-nav a {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.top-nav a:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.top-nav a.nav-featured-link {
  color: var(--text);
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.top-nav a.nav-featured-link:hover {
  border-color: var(--border-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-btn[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Theme toggle button CSS branching (works with and without JS) */
.theme-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Default system = light -> offer switch to dark */
.theme-opt--to-light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .theme-opt--to-dark {
    display: none;
  }
  .theme-opt--to-light {
    display: inline-flex;
  }
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-opt--to-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-opt--to-light {
  display: inline-flex;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-opt--to-dark {
  display: inline-flex;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) .theme-opt--to-light {
  display: none;
}

/* Hero & Search */
.hero {
  padding: 44px 0 28px;
  border-bottom: 1px solid var(--border);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 22px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.hero-lead {
  margin: 0 0 22px;
  max-width: 680px;
  font-size: 14.5px;
  color: var(--muted);
}

.search-wrap {
  position: relative;
  max-width: 720px;
}

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

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 92px 0 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.search-input::placeholder {
  color: var(--faint);
}

.search-input:focus {
  outline: none;
  border-color: var(--border-strong);
}

.search-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kbd-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  user-select: none;
}

.clear-btn {
  display: none;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-subtle);
}

.clear-btn.is-visible {
  display: inline-flex;
}

.clear-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.pill.is-active {
  background: var(--ink-btn-bg);
  color: var(--ink-btn-fg);
  border-color: var(--ink-btn-bg);
}

.pill-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.72;
}

.result-status {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Featured & Recent Strips */
.strip-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.strip-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}

.strip-action {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.strip-action:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
  gap: 8px;
}

.featured-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.featured-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.featured-item--highlight {
  border-color: var(--border-strong);
}

.featured-name {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.featured-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.arrow-glyph {
  font-size: 12px;
  color: var(--faint);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.featured-item:hover .arrow-glyph,
.tool-card:hover .arrow-glyph {
  color: var(--text);
  transform: translate(1px, -1px);
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.recent-chip:hover {
  border-color: var(--border-strong);
}

.recent-chip span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* Mobile Category Horizontal Rail */
.mobile-cats {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.mobile-cat-link {
  flex: 0 0 auto;
  padding: 5px 11px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

.mobile-cat-link.is-active {
  color: var(--ink-btn-fg);
  background: var(--ink-btn-bg);
  border-color: var(--ink-btn-bg);
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 40px;
  padding: 32px 0 64px;
  align-items: start;
}

/* Sticky Minimalist Sidebar */
.sidebar {
  position: sticky;
  top: 80px;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px 8px;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--muted);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.sidebar-link.is-active {
  color: var(--text);
  background: var(--surface-subtle);
  font-weight: 600;
}

.sidebar-link.is-dimmed {
  opacity: 0.38;
}

.sidebar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-idx {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  flex-shrink: 0;
}

.sidebar-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-cnt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  flex-shrink: 0;
}

/* Category Sections */
.catalog {
  display: flex;
  flex-direction: column;
  gap: 44px;
  min-width: 0;
}

/* Strictly applied only to below-the-fold sections (index >= 2) */
.cat-section--deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 520px;
}

.cat-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.cat-title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.cat-index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.cat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cat-en {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.cat-desc {
  margin: 4px 0 0;
  width: 100%;
  font-size: 13px;
  color: var(--muted);
}

.cat-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Tool Card Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

body.density-compact .tools-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tool-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.tool-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px 14px;
  height: 100%;
  min-width: 0;
}

body.density-compact .tool-link {
  padding: 11px 12px 10px;
  gap: 5px;
}

.tool-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 26px;
  min-width: 0;
}

.tool-monogram {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

body.density-compact .tool-monogram {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.tool-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.density-compact .tool-name {
  font-size: 13.5px;
}

.tool-desc {
  margin: 0;
  font-size: 12.8px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

body.density-compact .tool-desc {
  font-size: 12px;
  -webkit-line-clamp: 1;
}

.tool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  min-width: 0;
}

.tool-host {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.micro-tag {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-subtle);
  line-height: 1.4;
}

.fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: color 0.15s ease, background-color 0.15s ease;
}

body.density-compact .fav-btn {
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
}

.fav-btn:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.fav-btn[aria-pressed="true"] {
  color: var(--star);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.reset-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink-btn-bg);
  color: var(--ink-btn-fg);
  font-size: 13px;
  font-weight: 500;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.15s ease;
  z-index: 30;
}

.back-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-top:hover {
  border-color: var(--border-strong);
}

/* Responsive */
@media (max-width: 1080px) {
  .tools-grid,
  body.density-compact .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 20px;
  }
  .sidebar {
    display: none;
  }
  .mobile-cats {
    display: flex;
  }
  .brand-sub {
    display: none;
  }
  .top-nav a.hide-mobile {
    display: none;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }
  .tools-grid,
  body.density-compact .tools-grid {
    grid-template-columns: 1fr;
  }
  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kbd-hint {
    display: none;
  }
  .search-input {
    padding-right: 60px;
  }
}
