/* ── UX Icons — stylesheet ──────────────────────────────────────────────
   Theme tokens, chrome, landing, directory grids, and detail pages.
   Modeled on ux-components.com: Helvetica, bordered cards, four themes
   (light default, dark, beige, blue) switched by a class on <html>. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, a, select, summary, label[for] { cursor: pointer; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ── Theme tokens ── */
:root {
  color-scheme: light;
  --scrollbar-thumb: #333333;
  scrollbar-color: var(--scrollbar-thumb) transparent;
  --bg: #ffffff;
  --bg-sidebar: #f4f4f4;
  --bg-card: #ffffff;
  --bg-input: #f4f4f4;
  --bg-hover: #ececec;
  --border: #e2e2e2;
  --text: #111111;
  --text-muted: #6b6b6b;
  --text-subtle: #9a9a9a;
  --accent: #111111;
  --tag-use: #dcfce7;
  --tag-use-text: #166534;
  --tag-what: #dbeafe;
  --tag-what-text: #1d4ed8;
  --header-height: 60px;
  --font-sans: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  --transition-color: color 0.15s;
  --transition-bg: background 0.15s;
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-header: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.08);
  --icon-filter: none;
  --landing-ramp: #eceef1;
}
:root.beige {
  --bg: #f5f0e8;
  --bg-sidebar: #ece5d8;
  --bg-card: #e8e0d0;
  --bg-input: #e2d9c8;
  --bg-hover: #ddd4c2;
  --border: #b5a78e;
  --text: #3d3428;
  --text-muted: #6b5d4d;
  --text-subtle: #8a7a66;
  --accent: #5c4a32;
  --landing-ramp: #ece5d8;
}
:root.dark {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-sidebar: #111111;
  --bg-card: #1e1e1e;
  --bg-input: #282828;
  --bg-hover: #252525;
  --border: #444444;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --text-subtle: #8a8a8a;
  --accent: #ffffff;
  --tag-use: #166534;
  --tag-use-text: #bbf7d0;
  --tag-what: #1e3a5f;
  --tag-what-text: #bfdbfe;
  --icon-filter: invert(0.88);
  --landing-ramp: #1a1a1a;
}
:root.blue {
  color-scheme: dark;
  --bg: #0d1b2a;
  --bg-sidebar: #132337;
  --bg-card: #1b2d42;
  --bg-input: #233a52;
  --bg-hover: #1f3450;
  --border: #3d5a78;
  --text: #ffffff;
  --text-muted: #8fb0cc;
  --text-subtle: #7a9dba;
  --accent: #60a5fa;
  --tag-use: #0d3b2e;
  --tag-use-text: #86efac;
  --tag-what: #1e3a5f;
  --tag-what-text: #93c5fd;
  --icon-filter: invert(0.88);
  --landing-ramp: #16283d;
}

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

/* ── Base ── */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-height);
}
main { flex: 1 0 auto; }
h1 { font-size: 36px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
code { font-family: var(--font-mono); font-size: 13px; }
a { color: inherit; }
.accent-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.accent-link:hover { opacity: 0.75; }
.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 10000;
  padding: 8px 16px; background: var(--accent); color: var(--bg);
  border-radius: 6px; font-size: 14px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }
/* Keyboard focus: a soft grey ring instead of a black outline. */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bg-hover); }
.sheet-opt:focus-visible, .lib-sidenav-item:focus-visible, .menu-link:focus-visible { box-shadow: inset 0 0 0 2px var(--border); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 6px; border: 3px solid var(--bg); }

/* Rendered library icons are black SVGs from each library's CDN; the
   dark themes invert them so they read on dark surfaces. */
.ico { display: inline-block; flex-shrink: 0; filter: var(--icon-filter); object-fit: contain; }
.ico-missing { display: inline-block; width: 1em; height: 1em; }

/* ── Top nav (modeled on ux-guidelines.com): hamburger, brand, centered
   search, settings. Fixed; the hamburger opens the full-width panel. ── */
.topnav {
  height: var(--header-height);
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-header);
  position: fixed; left: 0; right: 0; top: 0; z-index: 400;
}
.brand-row { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.brand {
  font-size: 16px; font-weight: 600; letter-spacing: -0.2px; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.hamburger {
  background: none; border: none; width: 44px; height: 44px; padding: 6px; margin-left: -10px;
  display: flex; align-items: center; justify-content: center; color: var(--text); border-radius: 6px;
  transition: var(--transition-color), var(--transition-bg);
}
.hamburger:hover { color: var(--text-muted); background: var(--bg-hover); }
.hamburger .ico-close { display: none; }
.hamburger[aria-expanded="true"] .ico-menu { display: none; }
.hamburger[aria-expanded="true"] .ico-close { display: block; }
.search-wrap { position: relative; margin: 0 auto; flex: 0 1 440px; min-width: 0; }
/* The home page has its own hero search; the top bar's stays hidden there. */
body.is-home .search-wrap { display: none; }
@media (min-width: 981px) {
  .search-wrap { position: absolute; left: 50%; transform: translateX(-50%); width: 440px; margin: 0; }
}
.search-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none; z-index: 3;
}
.search-input {
  width: 100%; height: 42px; padding: 0 38px 0 42px; background: var(--bg-input);
  border: none; border-radius: 10px; color: var(--text); font-size: 15px;
  font-family: inherit; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-radius 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-subtle); }
.search-input:focus { background: var(--bg-hover); box-shadow: 0 0 0 4px rgba(0,0,0,0.05); }
.search-wrap.typeahead-open .search-input { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.search-clear {
  display: none; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
  background: none; border: none; border-radius: 50%; color: var(--text-subtle); transition: var(--transition-color);
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 5;
}
.search-clear:hover { color: var(--text); background: var(--bg-hover); }
.search-clear.visible { display: flex; }
.settings-wrap { position: relative; flex-shrink: 0; margin-left: auto; display: flex; align-items: center; }
.help-wrap { position: relative; flex-shrink: 0; display: flex; align-items: center; }
.settings-btn {
  background: none; border: none; color: var(--text-muted); width: 40px; height: 40px; padding: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; transition: var(--transition-color), var(--transition-bg);
}
.settings-btn:hover { color: var(--text); background: var(--bg-hover); }
@media (max-width: 600px) {
  .topnav { padding: 0 12px; }
  .search-wrap { flex: 1 1 auto; margin: 0 8px; }
  .search-input { height: 38px; font-size: 14px; }
}

/* ── Navigation panel (hamburger menu) ── */
.menu-overlay {
  position: fixed; inset: 0; background: rgba(17, 17, 17, 0.35); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }
.menu-panel {
  position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: var(--bg-sidebar); padding: 28px 48px 48px; z-index: 300;
  transform: translateY(-102%); transition: transform 0.28s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
.menu-panel { visibility: hidden; transition: transform 0.28s ease, visibility 0s linear 0.28s; }
.menu-panel.open { transform: translateY(0); visibility: visible; transition: transform 0.28s ease, visibility 0s; }
body.menu-open { overflow: hidden; }
.menu-label { font-size: 24px; font-weight: 600; letter-spacing: -0.3px; margin: 6px 0 18px; padding-left: 14px; }
.menu-links { display: block; }
.menu-links > .menu-home { display: inline-flex; margin-bottom: 18px; }
.menu-link {
  font-size: 15px; font-weight: 400; color: var(--text); padding: 6px 14px; margin: 1px 0;
  border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  text-decoration: none; transition: var(--transition-bg), var(--transition-color);
}
.menu-link:hover { background: var(--bg-hover); color: var(--text); }
.menu-link.active { background: var(--accent); color: var(--bg); font-weight: 600; }
.menu-link .ico { width: 16px; height: 16px; opacity: 0.7; }
.menu-link.active .ico { filter: invert(1) var(--icon-filter); opacity: 0.9; }
.menu-link-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-hover); border-radius: 999px; padding: 1px 7px; }
.menu-link.active .menu-link-count { background: rgba(255,255,255,0.18); color: inherit; }
.menu-link-all { font-weight: 600; }
.menu-groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 32px; align-items: start; }
.menu-group { border-bottom: none; }
.menu-group-label {
  list-style: none; font-size: 15px; font-weight: 600; color: var(--text); padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.menu-group-label::-webkit-details-marker { display: none; }
.menu-group-label h3 { font-size: inherit; font-weight: inherit; margin: 0; }
.menu-group-label::after {
  content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted); transform: rotate(45deg); transition: transform 0.2s ease; margin-top: -4px;
}
.menu-group[open] > .menu-group-label::after { transform: rotate(225deg); margin-top: 4px; }
@media (min-width: 701px) {
  .menu-group-label { pointer-events: none; }
  .menu-group-label::after { display: none; }
}
@media (max-width: 1100px) { .menu-groups { grid-template-columns: repeat(3, 1fr); gap: 16px 24px; } }
@media (max-width: 700px) {
  .menu-panel { padding: 24px 16px 32px; }
  .menu-groups { grid-template-columns: 1fr; gap: 0; }
  .menu-group { border-bottom: 1px solid var(--border); }
  .menu-group:last-child { border-bottom: none; }
}

/* ── Typeahead dropdown (header search) ── */
.typeahead {
  position: absolute; top: 100%; left: 0; right: 0; padding: 4px 0;
  background: var(--bg-card); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 12px 12px; max-height: 420px; overflow-y: auto; z-index: 120;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
}
.typeahead.open { opacity: 1; visibility: visible; transform: translateY(0); transition: opacity 0.18s, transform 0.18s, visibility 0s; }
.ta-section-label {
  padding: 12px 16px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}
.ta-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  text-decoration: none; color: var(--text); transition: background 0.1s;
}
.ta-item:hover, .ta-item.active { background: var(--bg-hover); }
.ta-item .ico { width: 18px; height: 18px; opacity: 0.8; }
.ta-item-name { font-weight: 600; font-size: 15px; white-space: nowrap; }
.ta-item-desc { font-size: 13px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-no-results { padding: 14px 16px; color: var(--text-muted); font-size: 15px; }

/* ── Settings sheet — full-width slide-down under the top bar, like the
   navigation panel (mirrors ux-guidelines.com) ── */
.settings-sheet {
  position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: var(--bg-sidebar); padding: 28px 48px 48px; z-index: 300;
  transform: translateY(-110%); visibility: hidden;
  transition: transform 0.28s ease, visibility 0s linear 0.28s;
  display: flex; flex-direction: column; overflow-y: auto;
}
.settings-sheet.open { transform: translateY(0); visibility: visible; transition: transform 0.28s ease, visibility 0s; }
/* Bookmarks sheet — same chrome as settings, with a table body */
.sheet-table { flex: 0 0 auto; }
.sheet-table .lib-table-wrap { background: var(--bg-card); }
.bm-empty { font-size: 15px; color: var(--text-muted); padding: 6px 14px 10px; line-height: 1.6; max-width: 60ch; }
body.sheet-open { overflow: hidden; }
.sheet-head { position: relative; flex-shrink: 0; }
.sheet-title { font-size: 24px; font-weight: 600; letter-spacing: -0.3px; margin: 6px 0 18px; padding-left: 14px; }
.sheet-close {
  position: absolute; top: -6px; right: -12px; width: 46px; height: 46px; padding: 0;
  background: none; border: none; color: var(--text-muted); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.sheet-close:hover { color: var(--text); background: var(--bg-hover); }
.sheet-close svg { width: 26px; height: 26px; }
.sheet-body { flex: 0 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 48px; align-items: start; }
.sheet-section { display: flex; flex-direction: column; }
.sheet-label { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; padding: 12px 14px; }
.sheet-opt {
  display: block; width: 100%; text-align: left; font-size: 15px; font-weight: 400; color: var(--text);
  padding: 6px 14px; margin: 1px 0; border-radius: 8px; background: transparent; border: none;
  transition: var(--transition-bg), var(--transition-color);
}
.sheet-opt:hover { background: var(--bg-hover); color: var(--text); }
.sheet-opt.active { background: var(--accent); color: var(--bg); font-weight: 600; }
.sheet-check { display: flex; align-items: center; gap: 10px; }
.sheet-check-box {
  width: 16px; height: 16px; border: 1.5px solid var(--text-subtle); border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: var(--transition-bg), var(--transition-color);
}
.sheet-check.on .sheet-check-box { background: var(--text); border-color: var(--text); color: var(--bg); }
.sheet-check:not(.on) { color: var(--text-muted); }
.sheet-font { display: flex; align-items: center; gap: 10px; padding: 6px 14px; }
.sheet-font-val { font-size: 13px; font-weight: 500; color: var(--text-muted); min-width: 36px; }
.sheet-font input[type="range"] { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; background: var(--border); border-radius: 2px; outline: none; }
.sheet-font input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); cursor: pointer; }
.sheet-font input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--text); cursor: pointer; }
.sheet-foot { display: flex; gap: 8px; padding: 0 14px; margin-top: 28px; flex-shrink: 0; }
.btn-save, .btn-cancel { padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.btn-save { background: var(--text); border: 1px solid var(--text); color: var(--bg); }
.btn-save:hover { opacity: 0.88; }
.btn-cancel { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-cancel:hover { background: var(--bg-hover); color: var(--text); }
/* Help sheet — tabs (Help / Keyboard shortcuts) over prose or a key table */
.sheet-tabs { display: flex; gap: 4px; padding: 0 14px; margin: -6px 0 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-tab {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 8px 12px; font-size: 14px; font-weight: 500; color: var(--text-muted); transition: var(--transition-color);
}
.sheet-tab:hover { color: var(--text); }
.sheet-tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.help-panel { padding: 0 14px; max-width: 980px; }
.help-panel[hidden] { display: none; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px 40px; }
.help-item h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.help-item p { font-size: 14px; line-height: 1.55; color: var(--text-muted); margin: 0; }
.keys-table { border-collapse: collapse; width: 100%; max-width: 640px; font-size: 14px; }
.keys-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); padding: 14px 0 6px; }
.keys-table td { padding: 8px 12px 8px 0; border-top: 1px solid var(--border); color: var(--text-muted); vertical-align: middle; }
.keys-table td:first-child { width: 160px; white-space: nowrap; }
kbd.key {
  display: inline-block; min-width: 22px; padding: 2px 7px; margin-right: 3px; text-align: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--text); background: var(--bg-card);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; line-height: 1.5;
}
.keys-then { font-size: 12px; color: var(--text-subtle); margin: 0 4px 0 1px; }
/* Back to top — floating; flips to white-on-black … black-on-white over the footer */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 250; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 1px solid transparent; background: var(--text); color: var(--bg);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-card-hover);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}
.to-top[hidden] { display: flex; }
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { opacity: 0.85; }
.to-top.on-footer { background: #ffffff; color: #111111; border-color: #e2e2e2; }
@media (max-width: 600px) {
  .to-top { right: 14px; bottom: 14px; width: 40px; height: 40px; }
  .settings-sheet { padding: 24px 16px 32px; }
  .sheet-body { grid-template-columns: 1fr; gap: 4px; }
  .sheet-close { right: -4px; }
}

/* ── Segmented toggles (theme chooser, language tabs, view + sort) ── */
.seg {
  display: inline-flex; flex-wrap: wrap; justify-content: center;
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px;
}
.seg:empty { display: none; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 5px;
  font-size: 13px; line-height: 1.4; font-weight: 500; border: none; background: transparent;
  color: var(--text-muted); white-space: nowrap; transform: scale(1);
  transition: background 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), color 0.22s, box-shadow 0.22s, transform 0.22s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.seg-btn:active { transform: scale(0.97); transition-duration: 0.08s; }
.seg-btn .lang-abbr { display: none; }
@media (max-width: 600px) {
  .seg-btn .lang-full { display: none; }
  .seg-btn .lang-abbr { display: inline; }
}

/* ── Landing hero ── */
.landing {
  display: flex; flex-direction: column; align-items: center; padding: 36px 24px 8px;
  background: linear-gradient(var(--landing-ramp) 0%, var(--bg) 420px); background-repeat: no-repeat;
}
.landing-hero { text-align: center; width: 100%; max-width: 600px; margin-bottom: 12px; }
.landing-lang-tabs { display: flex; width: fit-content; max-width: 100%; margin: 0 auto 24px; }
.landing-titlerow { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: clamp(2.5rem, 5vw, 3.4375rem); }
.landing-logo { color: var(--text-subtle); display: block; width: 1em; height: 1em; flex-shrink: 0; }
.landing-title { font-size: inherit; line-height: 1.1; letter-spacing: -1.5px; margin: 0; }
.landing-tagline { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin-top: 8px; text-wrap: balance; }
.landing-theme-chooser { display: flex; justify-content: center; margin-bottom: 32px; }
.landing-search {
  display: flex; align-items: center; gap: 12px; max-width: 780px; width: 100%;
  background: var(--bg-input); border-radius: 12px; padding: 16px 20px; margin-bottom: 14px;
  color: var(--text-muted); position: relative;
}
.landing-search > svg { flex-shrink: 0; }
.landing-search input {
  flex: 1; background: none; border: none; outline: none; font-family: var(--font-sans);
  font-size: 17px; color: var(--text); padding-right: 28px; min-width: 0;
}
.landing-search input::placeholder { color: var(--text-subtle); }
.landing-search .search-clear { right: 16px; }
.landing-search.typeahead-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.landing-search .typeahead { border-radius: 0 0 12px 12px; }
.landing-stats { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 40px; }
.landing-stats b { color: var(--text); font-weight: 600; }
.ta-item-all { border-top: 1px solid var(--border); margin-top: 4px; }
.ta-item-all .ta-item-name { font-weight: 500; color: var(--text-muted); font-size: 14px; }

/* ── Home hub — two bordered directory cards ── */
.landing-nav {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px;
  max-width: 1000px; width: 100%; margin-bottom: 40px; text-align: left;
}
.landing-card {
  display: flex; flex-direction: column; padding: 28px 28px 24px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card);
  transition: box-shadow 0.2s;
}
.landing-card:hover { box-shadow: var(--shadow-card-hover); }
.landing-nav-links { display: flex; flex-direction: column; }
.landing-nav-head {
  display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 600;
  letter-spacing: -0.4px; margin: 0 0 6px;
}
.landing-nav-head svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--text-subtle); }
.landing-nav-head a { color: var(--text); text-decoration: none; }
.landing-nav-head a:hover { text-decoration: underline; text-underline-offset: 4px; }
.landing-nav-count {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--bg-hover); border-radius: 999px; padding: 2px 8px; vertical-align: middle; white-space: nowrap;
}
.landing-nav-desc { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin: 0 0 12px; }
.landing-nav-link {
  font-size: 16px; color: var(--text); text-decoration: none; text-underline-offset: 3px;
  padding: 4px 0; transition: var(--transition-color);
}
.landing-nav-link:hover { color: var(--accent); text-decoration: underline; }
.landing-nav-primary { font-weight: 600; }
.landing-nav-sub {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-subtle); margin: 18px 0 6px;
}
.landing-nav-list { display: flex; flex-direction: column; }
.landing-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px;
  color: var(--text); text-decoration: none; transition: var(--transition-color);
}
.landing-nav-item .ico { width: 16px; height: 16px; opacity: 0.7; }
.landing-nav-item > span:first-of-type { flex: 1; }
.landing-nav-item:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:root.blue .landing-nav-link, :root.blue .landing-nav-item, :root.blue .landing-nav-head a { color: var(--text-muted); }
:root.blue .landing-nav-link:hover, :root.blue .landing-nav-item:hover { color: var(--accent); }

/* ── Directory page header + filter ── */
.dir-header { margin: 16px 0 28px; }
.dir-header h1 { margin-bottom: 10px; }
.filter-wrap { position: relative; flex: 1 1 260px; min-width: 0; }   /* grows with the toolbar */
.filter-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.filter-wrap input {
  width: 100%; padding: 8px 32px 8px 34px; background: var(--bg-input); border: 1px solid transparent;
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.filter-wrap input::placeholder { color: var(--text-muted); }
.filter-wrap input:focus { border-color: var(--border); }
.filter-wrap .search-clear { right: 8px; }
.toolbar-count { font-size: 13px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* ── Page containers ── */
.page { max-width: 1400px; margin: 0 auto; padding: 24px 24px 48px; }
.dir-section { margin-bottom: 56px; scroll-margin-top: calc(var(--header-height) + 16px); }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.section-head h2 { font-size: 30px; letter-spacing: -0.6px; }
.section-count {
  font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--bg-hover);
  padding: 3px 9px; border-radius: 999px;
}
.section-desc { font-size: 16px; color: var(--text-muted); line-height: 1.6; max-width: 720px; margin-bottom: 20px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar-spacer { flex: 1; }
.empty { color: var(--text-muted); font-size: 15px; padding: 24px 0; }
.empty button { background: none; border: none; color: var(--accent); text-decoration: underline; font-size: inherit; padding: 0; margin-left: 4px; }

/* ── Library cards ── */
.ds-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.ds-card {
  position: relative; display: flex; flex-direction: column; padding: 24px;
  border: 1px solid var(--border); background: var(--bg-card); text-decoration: none; color: var(--text);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.ds-card:hover { box-shadow: var(--shadow-card-hover); }
.ds-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ds-card-name { font-size: 18px; }
.ds-card-by { font-size: 13px; color: var(--text-muted); display: block; }
.ds-card-count {
  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--bg-hover); padding: 3px 8px; border-radius: 10px; white-space: nowrap;
}
.ds-card-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; flex: 1; margin-bottom: 14px; }
.ds-card-samples { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; min-height: 22px; }
.ds-card-samples .ico { width: 20px; height: 20px; opacity: 0.75; }
.ds-card-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ds-tag {
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--bg-hover); color: var(--text-muted); letter-spacing: 0.02em; text-decoration: none;
}
.ds-tag-site { background: var(--accent); color: var(--bg); }
.ds-tag-site:hover { opacity: 0.85; }
.ds-card-license { font-size: 12px; color: var(--text-subtle); margin-left: auto; }
/* List view */
.ds-grid.ds-list-view { grid-template-columns: 1fr; gap: 12px; }
.ds-list-view .ds-card { display: grid; grid-template-columns: 1fr auto; padding: 16px 24px; align-items: start; }
.ds-list-view .ds-card-header { display: contents; }
.ds-list-view .ds-card-header > div { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ds-list-view .ds-card-desc { grid-column: 1 / -1; margin: 4px 0 8px; }
.ds-list-view .ds-card-samples { grid-column: 1 / -1; margin-bottom: 8px; }
.ds-list-view .ds-card-tags { grid-column: 1 / -1; }

/* ── Universal icon cards ── */
.icon-cat { margin-bottom: 36px; }
.icon-cat-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.icon-cat-head h2 { font-size: 20px; font-weight: 700; }
.icon-cat { scroll-margin-top: calc(var(--header-height) + 16px); }
.compare-cat-row { scroll-margin-top: calc(var(--header-height) + 60px); }
.icon-cat-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-hover); padding: 1px 7px; border-radius: 10px; margin-left: 8px; vertical-align: middle; }
.icon-cat-head { gap: 2px; }
.icon-cat-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.icon-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border: 1px solid var(--border); background: var(--bg-card); text-decoration: none; color: var(--text);
  transition: box-shadow 0.2s;
}
.icon-card:hover { box-shadow: var(--shadow-card-hover); }
.icon-card-top { display: flex; align-items: center; gap: 12px; }
.icon-card-main { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--bg-hover); border-radius: 10px; flex-shrink: 0; }
.icon-card-main .ico { width: 26px; height: 26px; }
.icon-card-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.icon-card-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }
.icon-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; flex: 1; }
.icon-card-libs { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.icon-card-libs .ico { width: 16px; height: 16px; opacity: 0.65; }
.icon-card:hover .icon-card-libs .ico { opacity: 0.9; }
/* Table view — every icon's name in every library */
.compare-wrap { overflow: auto; max-height: calc(100vh - var(--header-height) - 24px); border: 1px solid var(--border); }
.compare-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.compare-table th {
  position: sticky; top: 0; z-index: 2; background: var(--bg-sidebar); text-align: left; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap; overflow: hidden;
}
.compare-table th:first-child { left: 0; z-index: 3; border-right: 1px solid var(--border); }
.compare-head { text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
a.compare-head:hover { color: var(--text); text-decoration: underline; }
.compare-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.compare-table td:first-child { position: sticky; left: 0; background: var(--bg-card); z-index: 1; border-right: 1px solid var(--border); }
.compare-cat-row td { background: var(--bg-hover); font-weight: 700; font-size: 14px; padding: 10px 12px; }
.compare-cat-row td:first-child { background: var(--bg-hover); }
/* The category label spans every column; keep it pinned at the left edge
   while the table scrolls sideways. */
.compare-cat-row td > span { position: sticky; left: 12px; display: inline-block; }
.compare-cell { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; position: relative; }
.compare-cell .ico { width: 16px; height: 16px; opacity: 0.75; flex-shrink: 0; }
.compare-link { color: var(--text); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.compare-link:hover { text-decoration: underline; }
.compare-name { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.compare-none { color: var(--text-subtle); }

/* Styled tooltip — full text of a truncated name, on hover or focus. */
/* Custom tooltips — black background, white type, on every theme. */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-within::after {
  content: attr(data-tip);
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30;
  background: #111111; color: #ffffff; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  line-height: 1.3; padding: 6px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
[data-tip]:hover::before, [data-tip]:focus-within::before {
  content: ''; position: absolute; left: 12px; bottom: calc(100% + 1px); z-index: 30;
  border: 5px solid transparent; border-top-color: #111111; pointer-events: none;
}
/* Descriptions on tiles and cards wrap, in the body face, and open below. */
.lib-tile[data-tip]:hover::after, .lib-icon-card-wrap[data-tip]:hover::after {
  bottom: auto; top: calc(100% + 6px); white-space: normal; width: 240px; max-width: 70vw;
  font-family: var(--font-sans); font-size: 12.5px; line-height: 1.45;
}
.lib-tile[data-tip]:hover::before, .lib-icon-card-wrap[data-tip]:hover::before {
  bottom: auto; top: calc(100% + 1px); border-top-color: transparent; border-bottom-color: #111111;
}
.lib-tile[data-tip]:hover, .lib-icon-card-wrap[data-tip]:hover { z-index: 5; }
/* Bookmark buttons: short label, opens below, right-aligned in corners. */
.bm-btn[data-tip]:hover::after, .bm-remove[data-tip]:hover::after, .copy-name[data-tip]:hover::after { bottom: auto; top: calc(100% + 6px); left: auto; right: 0; font-family: var(--font-sans); }
.bm-btn[data-tip]:hover::before, .bm-remove[data-tip]:hover::before, .copy-name[data-tip]:hover::before { bottom: auto; top: calc(100% + 1px); left: auto; right: 10px; border-top-color: transparent; border-bottom-color: #111111; }
.bm-btn[data-tip]:hover, .bm-remove[data-tip]:hover, .copy-name[data-tip]:hover { z-index: 6; }
/* A hovered card's own tooltip would cover the buttons' tooltips. */
.lib-tile:has(.card-actions:hover)::after, .lib-tile:has(.card-actions:hover)::before,
.lib-icon-card-wrap:has(.card-actions:hover)::after, .lib-icon-card-wrap:has(.card-actions:hover)::before { display: none; }
.across-render .copy-name { margin-left: auto; }
/* Tooltips in the first table row would be clipped above the sticky
   header, so flip them below the cell there. */
.compare-table thead [data-tip]:hover::after { bottom: auto; top: calc(100% + 6px); }
.compare-table thead [data-tip]:hover::before { bottom: auto; top: calc(100% + 1px); border-top-color: transparent; border-bottom-color: #111111; }

/* ── Detail pages ── */
.detail-page { max-width: 1000px; margin: 0 auto; padding: 40px 24px 64px; }
.detail-title { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-back {
  background: none; border: none; font-weight: 400; color: var(--text-muted); font-size: 36px;
  letter-spacing: -1px; padding: 0; transition: var(--transition-color); text-decoration: none;
}
.detail-back:hover { color: var(--text); }
.detail-chevron { margin: 0 4px; color: var(--text-muted); }
.detail-name { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 12px; }
.detail-name .ico { width: 36px; height: 36px; }
.detail-site-link {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500;
  color: var(--accent); text-decoration: none; padding: 4px 10px; border: 1px solid var(--accent);
  border-radius: 6px; white-space: nowrap; margin: 8px 8px 20px 0; transition: var(--transition-bg), var(--transition-color);
}
.detail-site-link:hover { background: var(--accent); color: var(--bg); }
.detail-desc { font-size: 18px; color: var(--text-muted); line-height: 1.65; margin: 4px 0 0; max-width: 780px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 32px; }
.detail-section { margin-bottom: 36px; }
.detail-section h2 { font-size: 22px; margin-bottom: 12px; }
.detail-section h2 .icon-cat-count { margin-left: 8px; vertical-align: middle; }
.detail-section p { color: var(--text-muted); line-height: 1.7; max-width: 780px; }
.detail-list { padding-left: 20px; color: var(--text-muted); line-height: 1.7; }
.detail-list li { margin-bottom: 4px; }
.detail-two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.detail-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; font-size: 13px; color: var(--text-muted); }
.acc-btn { background: none; border: none; font-size: 13px; color: var(--text-muted); padding: 0; }
.acc-btn:hover { color: var(--text); }
.acc-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 8px 0; text-align: left; font-size: 22px; font-weight: 700; color: var(--text); }
.acc-chevron { color: var(--text-muted); transition: transform 0.2s; }
.acc-toggle[aria-expanded="true"] .acc-chevron { transform: rotate(90deg); }
.install-block { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.install-label { font-size: 12px; font-weight: 600; color: var(--text-muted); min-width: 48px; text-align: right; flex-shrink: 0; }
.install-pre { margin: 0; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; overflow-x: auto; flex: 1; }
.install-pre code { color: var(--text); white-space: pre; }
.copy-btn { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 12px; padding: 5px 9px; flex-shrink: 0; }
.copy-btn:hover { color: var(--text); background: var(--bg-hover); }

/* Library detail — icons mapped grid */
.lib-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 8px; }
.lib-icon-card {
  display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: var(--transition-bg);
}
.lib-icon-card-wrap:hover .lib-icon-card, .lib-icon-card:hover { box-shadow: var(--shadow-card-hover); }
.lib-icon-card { transition: box-shadow 0.2s; }
.lib-icon-card .ico { width: 28px; height: 28px; opacity: 0.8; margin-bottom: 6px; }
.lib-icon-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.lib-icon-sub { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--text); }   /* universal name, like .icon-card-name */

/* Library detail — layout with a sticky left category nav */
.detail-page.wide { max-width: 1300px; }
.lib-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; align-items: start; }
.lib-sidenav {
  position: sticky; top: calc(var(--header-height) + 16px); max-height: calc(100vh - var(--header-height) - 32px);
  overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column;
}
.lib-sidenav:empty { display: none; }

.lib-sidenav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); margin: 0 0 8px 10px; }
.lib-sidenav-list { display: flex; flex-direction: column; gap: 1px; }
.lib-sidenav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px;
  border-radius: 6px; font-size: 13.5px; color: var(--text-muted); text-decoration: none;
  transition: var(--transition-bg), var(--transition-color);
}
.lib-sidenav-item:hover { background: var(--bg-hover); color: var(--text); }
/* Sections on screen: --spy runs 1 (topmost, darkest) → 0.2 (bottom, lightest). */
.lib-sidenav-item.vis { background: var(--bg-hover); color: var(--text); }
.lib-sidenav-item.vis { background: color-mix(in srgb, var(--text) calc(var(--spy, 1) * 14%), transparent); }
.lib-sidenav-item.active { color: var(--text); font-weight: 600; }
.lib-sidenav-item:first-child { font-weight: 600; color: var(--text); margin-bottom: 6px; }
#icons-sidenav .lib-sidenav-item:first-child { font-weight: inherit; color: inherit; margin-bottom: 0; }
#icons-sidenav .lib-sidenav-item:first-child.active { font-weight: 600; color: var(--text); }
.lib-sidenav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-sidenav-count { font-size: 11px; color: var(--text-subtle); flex-shrink: 0; }
.lib-main { min-width: 0; }
.lib-main .detail-section { scroll-margin-top: calc(var(--header-height) + 16px); }
@media (max-width: 900px) {
  .lib-layout { display: block; }
  .lib-sidenav {
    position: static; max-height: none; margin: 0 0 24px; padding: 0 0 12px; border-bottom: 1px solid var(--border);
  }

  .lib-sidenav-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .lib-sidenav-item { flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; margin: 0 !important; }
}

/* ── Bookmarks ── */
.bm-btn {
  background: none; border: none; color: var(--text-subtle); width: 28px; height: 28px; padding: 0;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: var(--transition-color), var(--transition-bg), opacity 0.15s;
}
.bm-btn:hover { color: var(--text); background: var(--bg-hover); }
.bm-btn.active { color: var(--accent); }
.bm-btn.active svg { fill: currentColor; }
/* Copy-name button: same look as the bookmark button; turns into a check when copied. */
.copy-name {
  background: none; border: none; color: var(--text-subtle); width: 28px; height: 28px; padding: 0;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: var(--transition-color), var(--transition-bg);
}
.copy-name:hover { color: var(--text); background: var(--bg-hover); }
.copy-name.copied { color: var(--accent); }
/* Copy menu — one floating menu for every copy button. */
.copy-menu {
  position: fixed; z-index: 500; min-width: 190px; padding: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.16);
}
.copy-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px;
  background: transparent; border: 0; text-align: left; font-size: 14px; color: var(--text);
  transition: var(--transition-bg);
}
.copy-menu button:hover, .copy-menu button:focus-visible { background: var(--bg-hover); box-shadow: none; }
.copy-menu button:disabled { opacity: 0.7; }
.copy-menu button.done { color: var(--accent); font-weight: 600; }
.copy-menu button.fail { color: var(--text-muted); }
.copy-menu-val { margin-left: auto; font-size: 12px; color: var(--text-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-menu-more { margin-left: auto; color: var(--text-subtle); font-size: 16px; line-height: 1; }
.copy-menu [data-act="png"][aria-expanded="true"] .copy-menu-more { transform: rotate(90deg); display: inline-block; }
.copy-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 12px 8px 12px; max-width: 260px; }
.copy-sizes-label { flex-basis: 100%; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-subtle); padding: 2px 0 4px; }
.copy-menu .copy-sizes button { width: auto; padding: 5px 9px; font-family: var(--font-mono); font-size: 12px; border: 1px solid var(--border); border-radius: 6px; }
.copy-menu .copy-sizes button.done { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.card-actions .copy-name[aria-expanded="true"], .cell-actions .copy-name[aria-expanded="true"] { color: var(--text); background: var(--bg-hover); }
.card-actions:has([aria-expanded="true"]), .cell-actions:has([aria-expanded="true"]) { opacity: 1; }
/* Copy + bookmark together in a card corner; shown on hover, or always when bookmarked. */
.card-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 0; opacity: 0; z-index: 2; transition: opacity 0.15s; }
.card-actions:has(.bm-btn.active), .card-actions:focus-within,
.icon-card-wrap:hover .card-actions, .lib-tile:hover .card-actions, .lib-icon-card-wrap:hover .card-actions { opacity: 1; }
.card-actions .bm-btn, .card-actions .copy-name { width: 26px; height: 26px; }
/* Inline actions in table cells: shown on row hover. */
.cell-actions { display: inline-flex; align-items: center; gap: 0; margin-left: auto; opacity: 0; transition: opacity 0.15s; }
tr:hover .cell-actions, .cell-actions:focus-within, .cell-actions:has(.bm-btn.active) { opacity: 1; }
.cell-actions .bm-btn, .cell-actions .copy-name, .cell-actions .bm-remove { width: 24px; height: 24px; }
.lib-table .lib-col-bm { width: 64px; }
.lib-table .lib-col-bm .cell-actions { opacity: 1; justify-content: flex-end; width: 100%; }
.compare-cell .cell-actions { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: inherit; }
.bm-inline { width: 22px; height: 22px; }
.bm-title { width: 36px; height: 36px; margin-left: 6px; align-self: center; }
.bm-title svg { width: 20px; height: 20px; }
.icon-card-wrap, .lib-icon-card-wrap { position: relative; display: flex; }
.icon-card-wrap > .icon-card, .lib-icon-card-wrap > .lib-icon-card { flex: 1; }
.bookmarks-wrap { position: relative; flex-shrink: 0; margin-left: auto; display: flex; align-items: center; }
.bookmarks-wrap + .settings-wrap { margin-left: 0; }
.bm-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--bg); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bm-remove {
  border: 0; background: transparent; color: var(--text-subtle); width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0; position: relative;
}
.bm-remove:hover { color: var(--text); background: var(--bg-hover); }

/* Library detail — the library's complete icon set */
.svgi { display: block; color: var(--text); }
.lib-all-filter { margin: 0 0 18px; }
.lib-all-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 8px; }
.lib-tile {
  position: relative; display: flex; border: 1px solid var(--border); background: var(--bg-card);
  border-radius: 8px; transition: var(--transition-bg);
}
.lib-tile:hover { box-shadow: var(--shadow-card-hover); }
.lib-tile { transition: box-shadow 0.2s; }
/* Same anatomy as .lib-icon-card: icon, title, code name, description */
.lib-tile-link {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px;
  text-decoration: none; color: var(--text); text-align: left;
}
.lib-tile .svgi { width: 28px; height: 28px; margin-bottom: 6px; opacity: 0.8; }
.lib-icon-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.lib-icon-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.45; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-icon-use { margin-top: 2px; -webkit-line-clamp: 2; }
.lib-group { margin-bottom: 20px; }
.lib-group-head { font-size: 18px; font-weight: 700; margin: 4px 0 6px; }
.lib-sub-head {
  font-size: 14px; font-weight: 600; text-transform: capitalize; letter-spacing: 0; color: var(--text-muted);
  margin: 14px 0 8px; display: flex; align-items: center; gap: 8px;
}
.lib-sub-count { font-size: 10px; font-weight: 600; color: var(--text-subtle); background: var(--bg-hover); border-radius: 999px; padding: 1px 6px; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.lib-table .lib-col-bm { width: 36px; text-align: right; }
.lib-tile-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--text); text-align: left; word-break: break-all; line-height: 1.3; }
.lib-cat .acc-toggle { font-size: 18px; }
.lib-view-toolbar { margin-bottom: 24px; display: flex; align-items: center; gap: 12px; }
#lib-search-slot { flex: 1 1 auto; min-width: 0; }
#lib-search-slot .filter-wrap { max-width: none; }
.lib-view-toolbar .lib-all-filter { margin: 0; }
.lib-view-seg { margin-left: auto; }
/* Table view — icon, name, universal icon, when to use */
.lib-table-wrap { overflow-x: auto; border: 1px solid var(--border); margin-bottom: 8px; }
.lib-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lib-table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: var(--bg-sidebar); padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.lib-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lib-table tr:last-child td { border-bottom: none; }
.lib-table .lib-col-icon { width: 46px; }
.lib-table td.lib-col-icon .ico, .lib-table td.lib-col-icon .svgi { width: 22px; height: 22px; }
.lib-table .lib-col-desc { min-width: 280px; color: var(--text-muted); line-height: 1.5; }
.lib-code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.lib-table-link { color: var(--text); text-decoration: none; font-weight: 600; }
.lib-table-link:hover { text-decoration: underline; }
.lib-table-cat { display: block; font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.lib-table .lib-cat-row td { background: var(--bg-hover); font-weight: 700; font-size: 14px; padding: 10px 12px; }
.lib-table .lib-sub-row td, .compare-sub-row td {
  background: var(--bg-sidebar); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 6px 12px;
}
.compare-sub-row td > span { position: sticky; left: 12px; display: inline-block; }
.lib-all-status { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.lib-loading { color: var(--text-muted); font-size: 14px; padding: 12px 0; }

/* Icon detail — sizes strip and per-library cards */
.icon-sizes { display: flex; align-items: flex-end; gap: 28px; padding: 20px 24px; border: 1px solid var(--border); background: var(--bg-card); margin-bottom: 36px; flex-wrap: wrap; }
.icon-size-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.icon-size-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }
.across-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.across-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); background: var(--bg-card); transition: box-shadow 0.2s; }
.across-card:hover { box-shadow: var(--shadow-card-hover); }
.across-lib { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.across-lib:hover { text-decoration: underline; }
.across-lib svg { color: var(--text-subtle); }
.across-render { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.across-render .ico { width: 40px; height: 40px; }
.across-name { font-family: var(--font-mono); font-size: 13px; color: var(--text); word-break: break-all; }
/* Icon names copy on click */
.lib-icon-name, .lib-tile-name, .lib-code, .compare-name, .across-name { cursor: copy; }
.lib-icon-name:hover, .lib-tile-name:hover, .lib-code:hover, .compare-name:hover, .across-name:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.lib-icon-name.copied, .lib-tile-name.copied, .lib-code.copied, .compare-name.copied, .across-name.copied { color: var(--tag-use-text); text-decoration: none; }
.lib-icon-name.copy-failed, .lib-tile-name.copy-failed, .lib-code.copy-failed, .compare-name.copy-failed, .across-name.copy-failed { color: #b91c1c; text-decoration: none; }
.across-open { font-size: 12px; color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-top: auto; }
.across-open:hover { color: var(--text); text-decoration: underline; }
.related-row { display: flex; flex-wrap: wrap; gap: 8px; }
.related-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border);
  background: var(--bg-card); text-decoration: none; color: var(--text); font-size: 14px; border-radius: 8px; transition: var(--transition-bg);
}
.related-chip:hover { box-shadow: var(--shadow-card-hover); }
.related-chip { transition: box-shadow 0.2s; }
.related-chip .ico { width: 18px; height: 18px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── About ── */
.about-body { max-width: 780px; }
.about-body h2 { font-size: 22px; margin: 28px 0 10px; }
.about-body p { color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }

/* ── Footer ── */
.home-footer { background: var(--bg-sidebar); color: var(--text-muted); padding: 44px 32px 24px; margin-top: auto; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; max-width: 1100px; margin: 0 auto 32px; }
.footer-logo { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.footer-line { font-size: 14px; line-height: 1.6; max-width: 380px; }
.footer-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); margin-bottom: 10px; }
.footer-col a { display: block; color: var(--text-muted); text-decoration: none; font-size: 14px; padding: 3px 0; }
.footer-col a:hover { color: var(--text); }
.footer-social { display: flex; gap: 10px; margin-top: 18px; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: var(--bg-hover); color: var(--text-muted); }
.footer-social a:hover { background: var(--border); color: var(--text); }
.footer-social svg { width: 16px; height: 16px; fill: currentColor; }
.footer-bottom { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; padding-top: 18px; border-top: 1px solid var(--border); }
/* Light theme — dark footer band for contrast against white. */
:root:not(.dark):not(.blue):not(.beige) .home-footer { background: #111111; color: #9a9a9a; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-logo { color: #ffffff; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-line,
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-col a,
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-bottom { color: #9a9a9a; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-head { color: #8a8a8a; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-col a:hover { color: #ffffff; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-social a { background: rgba(255,255,255,0.08); color: #9a9a9a; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-social a:hover { background: rgba(255,255,255,0.14); color: #ffffff; }
:root:not(.dark):not(.blue):not(.beige) .home-footer .footer-bottom { border-top-color: rgba(255,255,255,0.12); }

/* ── Responsive ── */
@media (max-width: 1100px) { .ds-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .detail-two { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .landing-nav { grid-template-columns: 1fr; gap: 16px; }
  .landing-card { padding: 22px 20px 20px; }
  .filter-wrap { flex-basis: 100%; max-width: none; }
  .toolbar-count { margin-left: 0; }
  .nav-links { display: none; }
  .ds-grid { grid-template-columns: 1fr; }
  .page { padding: 16px 16px 40px; }
  .section-head h2 { font-size: 26px; }
  .landing { padding: 24px 16px 8px; }
  .landing-search { padding: 13px 16px; }
  .detail-page { padding: 24px 16px 48px; }
  .detail-back, .detail-title { font-size: 28px; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .footer-top { grid-template-columns: 1fr; gap: 24px; }
  .install-label { display: none; }
}
@media (max-width: 480px) {
  .icon-grid { grid-template-columns: 1fr 1fr; }
  .icon-card-desc { display: none; }
}

/* Installation accordion on library pages */
.lib-install { margin-bottom: 20px; }
.lib-install .acc-toggle { padding: 4px 0; }
.lib-install #lib-install-body { padding-top: 10px; }

/* Library page: site link + pills in one row under the breadcrumb */
.detail-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 18px; }
.detail-pills .detail-site-link { margin: 0 4px 0 0; }
.detail-pills + .detail-desc { margin-bottom: 28px; }

/* Library page: universal section accordion + page-level controls */
#lib-acc-controls { margin: -8px 0 16px; }
#lib-universal .acc-toggle { padding: 4px 0; }
