:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2230;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #b1bac4;
  --accent: #58a6ff;
  --accent-dim: #1f3a5f;
  --green: #3fb950;
  --green-dim: #0d2a14;

  --cat-documentation: #4f9bff;
  --cat-documentation-bg: #0d2137;
  --cat-code-quality: #d29922;
  --cat-code-quality-bg: #2a1f00;
  --cat-productivity: #3fb950;
  --cat-productivity-bg: #0d2a14;
  --cat-automation: #bc8cff;
  --cat-automation-bg: #1e1040;
  --cat-finance: #bd9caa;
  --cat-finance-bg: #1e2035;
  --cat-design: #ad8caa;
  --cat-design-bg: #0e1035;
  --cat-database: #2dd4bf;
  --cat-database-bg: #0d2f2a;
  --cat-development: #9f99aa;
  --cat-development-bg: #0f3335;
  --cat-testing: #22d3ee;
  --cat-testing-bg: #0c2a30;
  --cat-devops: #818cf8;
  --cat-devops-bg: #1a1b3a;
  --cat-security: #f87171;
  --cat-security-bg: #2d0e0e;
  --cat-performance: #ec4899;
  --cat-performance-bg: #2e0f1f;
  --cat-mixed: #f97316;
  --cat-mixed-bg: #2a1500;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  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;
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  overflow: visible;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-left h1 span { color: var(--accent); }
.home-link { color: inherit; text-decoration: none; }
.home-link:hover { color: var(--accent); }

.header-left p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.btn-gh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-gh:hover { background: var(--surface-hover); border-color: var(--accent); }

/* ── Quick Start ── */
.quickstart {
  background: linear-gradient(135deg, #0d1f3c 0%, #0d1117 60%);
  border-bottom: 1px solid var(--border);
  padding: 28px 32px;
}

.quickstart-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.quickstart-note a { color: var(--accent); text-decoration: none; }
.quickstart-note a:hover { text-decoration: underline; }

.quickstart h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body { flex: 1; }

.step-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.step-cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  max-width: 560px;
}

.step-cmd code {
  font-size: 0.82rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Controls ── */
.controls {
  padding: 16px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  /* Reserve room for the filter chip row that materialises after data loads
   * so loading → loaded doesn't push <main> down. */
  min-height: 112px;
}

.search-form { display: contents; }

.search-wrap {
  position: relative;
  flex: 0 1 340px;
  min-width: 200px;
  display: flex;
  align-items: center;
}

#search {
  flex: 1;
  min-width: 0;
  padding: 7px 36px 7px 12px; /* right room for the .search-kbd hint */
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}
#search:focus { border-color: var(--accent); outline: none; }
#search::placeholder { color: var(--text-muted); }

/* Visible keyboard-shortcut hint chip. Hidden when the input is focused or
 * has content, so the chip never sits on top of the user's text. */
.search-kbd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.search-wrap:focus-within .search-kbd,
.search-wrap #search:not(:placeholder-shown) ~ .search-kbd {
  display: none;
}

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

.filter-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.filter-btn.active { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }

.sort-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.sort-btn:hover { color: var(--accent); border-color: var(--accent); }
.sort-icon { opacity: 0.75; margin-right: 4px; }
.sort-btn:hover .sort-icon { opacity: 1; }
.sort-label { /* targetable by tests; no visual change */ }

.view-toggle {
  margin-left: auto;
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
}

.view-btn {
  padding: 4px 12px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.view-btn.active { background: var(--accent-dim); color: var(--accent); }

/* ── Marketplace bar ── */
.marketplace-bar {
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  /* Reserve room for 2 rows of source-tag chips so loading → loaded
   * doesn't shift <main> down when chips wrap on narrower viewports. */
  min-height: 80px;
}

.marketplace-sources {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.source-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}
.source-tag:hover { border-color: var(--text-muted); color: var(--text); }
.source-tag:focus-within { border-color: var(--accent); }
.source-tag.builtin { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.source-tag.active  { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Toggle button — sits inside .source-tag, fills the chip body except the
 * copy button. Stretched-link overlay makes clicks anywhere on the chip body
 * activate it without nesting interactives. */
.source-toggle {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
}
.source-toggle:focus { outline: none; }
/* Visible keyboard focus ring (WCAG 2.4.7 / 2.4.11). Drawn on the
 * stretched-link overlay so it traces the full chip body, not just the
 * inline button text. */
.source-toggle:focus-visible { outline: none; }
.source-toggle:focus-visible::after {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.source-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.source-add-copy {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.source-add-copy:hover { background: rgba(255,255,255,0.08); border-color: currentColor; }
.source-tag.active .source-add-copy:hover { background: rgba(0,0,0,0.18); }
.source-add-copy.copied { color: var(--green); border-color: var(--green); }

.source-error { border-color: #f85149 !important; color: #f85149 !important; }

.marketplace-add-cta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 3px 0;
  transition: color 0.15s;
}
.marketplace-add-cta:hover { color: var(--accent); }

/* ── Main ── */
main { padding: 20px 32px 80px; }

.count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Skill Cards ── */
#plugins-grid,
#skills-grid,
#agents-grid,
#mcp-grid,
#commands-grid,
#hooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.skill-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  transition: border-color 0.15s, transform 0.1s;
}
.skill-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.skill-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-name {
  font-size: 0.92rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: break-word;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.card-name-text { text-decoration: inherit; }
/* "View details" affordance: signals that activating the name opens an
 * in-place panel, not a new page. Subtle at rest, brighter on hover/focus. */
.card-name-chevron {
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 1em;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}
.card-name:hover .card-name-chevron,
.card-name:focus-visible .card-name-chevron {
  opacity: 1;
  transform: translateX(2px);
}
.card-name:hover .card-name-text { text-decoration: underline; }
.card-name:focus { outline: none; }
/* Visible keyboard focus ring (WCAG 2.4.7 / 2.4.11). The card-name button
 * has a stretched-link ::after that already covers the whole card body, so
 * we paint the focus ring there to highlight the activation target. */
.card-name:focus-visible { outline: none; }
.card-name:focus-visible::after {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.card-name::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

/* Lift sibling interactive controls above the stretched-link overlay so
 * they remain independently clickable (copy button, "+N more" expand). */
.skill-card .card-install,
.skill-card .plugin-chips,
.skill-card .card-chips { position: relative; z-index: 1; }

.card-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-readonly { background: #21262d; color: var(--text-muted); border: 1px solid var(--border); }
.badge-rating { background: #2d2200; color: #e3b341; border: 1px solid #6e4c00; font-size: 0.72rem; letter-spacing: 0.01em; }
.badge-scan-ok   { background: var(--green-dim); color: var(--green); border: 1px solid #1a4d25; cursor: default; }
.badge-scan-warn { background: #2a1800; color: #e3a44a; border: 1px solid #6e4200; cursor: default; }
.badge-cat { border: none; }
.badge-marketplace { background: #1a2332; color: #58a6ff; border: 1px solid #1f6feb; font-family: monospace; }
.badge-documentation { background: var(--cat-documentation-bg); color: var(--cat-documentation); }
.badge-code-quality   { background: var(--cat-code-quality-bg);   color: var(--cat-code-quality); }
.badge-productivity   { background: var(--cat-productivity-bg);   color: var(--cat-productivity); }
.badge-automation     { background: var(--cat-automation-bg);     color: var(--cat-automation); }
.badge-finance     { background: var(--cat-finance-bg);     color: var(--cat-finance); }
.badge-design     { background: var(--cat-design-bg);     color: var(--cat-design); }
.badge-database     { background: var(--cat-database-bg);     color: var(--cat-database); }
.badge-development     { background: var(--cat-development-bg);     color: var(--cat-development); }
.badge-testing         { background: var(--cat-testing-bg);         color: var(--cat-testing); }
.badge-devops          { background: var(--cat-devops-bg);          color: var(--cat-devops); }
.badge-security        { background: var(--cat-security-bg);        color: var(--cat-security); }
.badge-performance     { background: var(--cat-performance-bg);     color: var(--cat-performance); }
.badge-mixed           { background: var(--cat-mixed-bg);           color: var(--cat-mixed); }
.badge-skill           { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

.badge-source {
  background: #0e1424;
  color: #8ba3c4;
  border: 1px solid #252f40;
  font-size: 0.65rem;
}

.card-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.card-desc.expanded {
  display: block;
  overflow: visible;
}

.card-install {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
}

.card-install code {
  font-size: 0.72rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Copy button (shared) ── */
.copy-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.copy-btn:hover { color: var(--accent); background: var(--accent-dim); border-color: var(--accent); }
.copy-btn.copied { color: var(--green); border-color: var(--green); background: var(--green-dim); }

/* ── Bundle Cards ── */
#bundles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.bundle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bundle-name { font-size: 1rem; font-weight: 600; }
.bundle-desc { font-size: 0.83rem; color: var(--text-muted); }

.bundle-skills { display: flex; flex-direction: column; gap: 4px; }

.bundle-skill-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bundle-skill-item::before { content: '▸'; color: var(--accent); font-size: 0.65rem; }
.bundle-item-kind {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle, var(--border));
  color: var(--text-muted);
  flex-shrink: 0;
}

.plugin-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; min-width: 0; }
.chip { font-size: 0.73rem; padding: 2px 8px; border-radius: 10px; max-width: 100%; word-break: break-word; }
.chip-skill  { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.chip-agent  { background: color-mix(in srgb, #a78bfa 12%, transparent); color: #a78bfa; border: 1px solid color-mix(in srgb, #a78bfa 30%, transparent); }
.chip-mcp     { background: color-mix(in srgb, #34d399 12%, transparent); color: #34d399; border: 1px solid color-mix(in srgb, #34d399 30%, transparent); }
.chip-command { background: color-mix(in srgb, #fb923c 12%, transparent); color: #fb923c; border: 1px solid color-mix(in srgb, #fb923c 30%, transparent); }
.chip-hook    { background: color-mix(in srgb, #e879f9 12%, transparent); color: #e879f9; border: 1px solid color-mix(in srgb, #e879f9 30%, transparent); }

.expand-btn {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.expand-btn:hover { border-color: var(--accent); color: var(--accent); }

.bundle-install {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bundle-install-primary,
.bundle-install-manual-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  position: relative;
}

.bundle-install pre {
  font-size: 0.72rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.7;
  padding-right: 60px;
  margin: 0;
}

.bundle-install-manual { font-size: 0.78rem; }
.bundle-install-manual > summary {
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 0;
}
.bundle-install-manual > summary:hover { color: var(--accent); }
.bundle-install-manual[open] > summary { margin-bottom: 6px; }

.bundle-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 8px;
  transition: color 0.15s, border-color 0.15s;
}
.bundle-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.bundle-copy-btn.copied { color: var(--green); border-color: var(--green); }

/* ── Empty / loading ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty p:first-child { font-size: 1.5rem; margin-bottom: 8px; }
.empty-hint { margin-top: 6px; font-size: 0.85rem; color: var(--text-muted); }

/* Placeholder cards rendered while skills_index.json is loading. Match
 * .skill-card's outer dimensions (border, radius, min-height) so the grid
 * reserves space and the layout doesn't shift when real cards arrive. */
.skeleton-card {
  min-height: 170px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-card { animation: none; opacity: 0.7; }
}

/* ── Footer ── */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 90;
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Inline button styled as a footer link — used by "Manage analytics consent". */
.footer-link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}
.footer-link-btn:hover { text-decoration: underline; }

/* ── Consent banner ── */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  z-index: 100;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}

.consent-banner-text {
  flex: 1;
  min-width: 280px;
  margin: 0;
  line-height: 1.5;
  color: var(--text-muted);
}

.consent-banner-link {
  color: var(--accent);
  text-decoration: underline;
}
.consent-banner-link:hover { text-decoration: none; }

.consent-banner-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* Equally-prominent Accept and Decline buttons (CNIL compliance —
   neither option may be visually emphasised over the other). */
.consent-banner-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  min-width: 110px;
}
.consent-banner-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .consent-banner {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .consent-banner-actions {
    justify-content: flex-end;
  }
  .consent-banner-btn { min-height: 44px; }
}

/* ── Plugin detail panel ── */
#plugin-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
#plugin-panel.open { pointer-events: all; }

#panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.25s ease;
}
#plugin-panel.open #panel-overlay { background: rgba(0,0,0,0.55); }

.panel-content {
  position: relative;
  width: min(520px, 95vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
#plugin-panel.open .panel-content { transform: translateX(0); }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.panel-name:hover { text-decoration: underline; }

.panel-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-close-btn:hover { background: var(--surface-hover); color: var(--text); }

.panel-share-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
}
.panel-share-btn:hover { background: var(--surface-hover); color: var(--text); }
.panel-share-btn.copied { color: var(--accent); border-color: var(--accent); }

.panel-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.panel-prompt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.panel-prompt-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 2px;
}
.panel-prompt-text {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
  min-width: 0;
}

.panel-section { display: flex; flex-direction: column; gap: 10px; }
.panel-scan-section { padding: 10px 14px; border-radius: 6px; }
.panel-scan-ok { color: var(--green); font-size: 0.82rem; }
.panel-scan-warn { display: flex; flex-direction: column; gap: 6px; }
.panel-scan-warn-title { color: #e3a44a; font-size: 0.82rem; font-weight: 600; }
.panel-scan-flags { margin: 0; padding-left: 1.2em; color: var(--text-muted); font-size: 0.78rem; display: flex; flex-direction: column; gap: 3px; }
.panel-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 10px;
  font-size: 0.68rem;
  padding: 1px 6px;
  margin-left: 4px;
  font-weight: 500;
  vertical-align: middle;
}

.panel-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-copy-btn, #panel-install-copy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.panel-copy-btn:hover, #panel-install-copy:hover { background: var(--surface-hover); color: var(--text); }

.panel-rating-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.panel-rating-stars { color: #e3b341; letter-spacing: 0.05em; }
.panel-rating-avg   { font-weight: 600; }
.panel-rating-count { color: var(--text-muted); font-size: 0.8rem; }

.panel-reviews { display: flex; flex-direction: column; gap: 8px; }
.panel-review {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.panel-review-header { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; }
.panel-review-stars  { color: #e3b341; letter-spacing: 0.05em; }
.panel-review-author { font-weight: 600; color: var(--text); }
.panel-review-date   { color: var(--text-muted); margin-left: auto; }
.panel-review-body   { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

.panel-no-reviews { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.panel-rate-buttons { display: flex; gap: 4px; }
.panel-rate-star {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #e3b341;
  font-size: 0.8rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: background 0.1s, border-color 0.1s;
}
.panel-rate-star:hover { background: #2d2200; border-color: #6e4c00; }

.panel-bundle-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.panel-bundle-name { font-size: 0.85rem; font-weight: 600; }
.panel-bundle-desc { font-size: 0.78rem; color: var(--text-muted); }

.panel-install-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.panel-install-row[hidden] { display: none; }
.panel-install-row code { flex: 1; font-size: 0.82rem; color: var(--text); word-break: break-all; }

.panel-install-footer {
  position: sticky;
  bottom: -24px;
  margin: auto -24px -24px;
  padding: 16px 24px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

/* ── Entity detail panel (left side, mirrors plugin panel) ── */
#entity-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-start;
  pointer-events: none;
}
#entity-panel.open { pointer-events: all; }

#entity-panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.25s ease;
}
#entity-panel.open #entity-panel-overlay { background: rgba(0,0,0,0.55); }

.entity-panel-content {
  position: relative;
  width: min(520px, 95vw);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
#entity-panel.open .entity-panel-content { transform: translateX(0); }

/* ── Catalog page (catalog.html) ── */
body.catalog-page footer {
  position: static;
  margin-top: 48px;
}

.catalog-page main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 24px;
}

.catalog-page .catalog-header {
  border-bottom: 1px solid var(--border);
  padding: 0 0 20px;
  margin-bottom: 28px;
}
.catalog-page .catalog-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.catalog-page .catalog-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.catalog-page section { margin-bottom: 40px; }

.catalog-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.catalog-page h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 22px 0 10px;
  color: var(--text);
}

.catalog-page .count-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

.catalog-marketplaces {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 0;
  margin: 0;
}
.catalog-marketplaces a { color: var(--accent); text-decoration: none; }
.catalog-marketplaces a:hover { text-decoration: underline; }

.catalog-page table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: block;
  overflow-x: auto;
}
.catalog-page thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  white-space: nowrap;
}
.catalog-page tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.catalog-page tbody tr:last-child td { border-bottom: none; }
.catalog-page tbody tr:hover { background: var(--surface-hover); }

.catalog-page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}
.catalog-page a code { color: var(--accent); border-color: var(--accent-dim); }
.catalog-page a { color: var(--accent); text-decoration: none; }
.catalog-page a:hover { text-decoration: underline; }

.catalog-page pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 0.82rem;
  margin: 8px 0 16px;
}
.catalog-page pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}

.catalog-page .bundle-desc {
  color: var(--text-muted);
  margin: 2px 0 8px;
  font-size: 0.88rem;
}

.panel-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.panel-code-block {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
}

.panel-source-link {
  font-size: 0.83rem;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.panel-source-link:hover { text-decoration: underline; }

.panel-section[hidden] { display: none; }


/* ── Bundle add button (on cards) ── */
.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.card-actions .card-install {
  flex: 1;
  min-width: 0;
}

.bundle-add-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.bundle-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.bundle-add-btn--active {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-dim);
}
.bundle-add-btn--active:hover {
  color: #f85149;
  border-color: #f85149;
  background: rgba(248,81,73,0.1);
}

/* Highlight cards that are in the current bundle */
.skill-card--bundled {
  border-color: var(--green);
}
.skill-card--bundled:hover {
  border-color: var(--green);
}

/* ── Bundle Drawer ── */
.bundle-drawer {
  position: fixed;
  bottom: 48px;   /* sit above footer */
  right: 24px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden by default — shown when items are present */
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bundle-drawer--open {
  pointer-events: all;
  opacity: 1;
  transform: translateY(0);
}

.bundle-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bundle-drawer-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.bundle-drawer-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.bundle-drawer-clear:hover { color: #f85149; border-color: #f85149; }

.bundle-drawer-list {
  list-style: none;
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 8px 0;
  margin: 0;
  max-height: 220px;
}

.bundle-drawer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  font-size: 0.8rem;
}
.bundle-drawer-item:hover { background: var(--surface-hover); }

.bundle-drawer-item-kind {
  font-size: 0.65rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.bundle-drawer-item-name {
  flex: 1;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-drawer-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.bundle-drawer-remove:hover { color: #f85149; }

.bundle-drawer-suggestion {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-subtle, var(--bg));
}
.bundle-drawer-goto {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}
.bundle-drawer-goto:hover { opacity: 0.8; }

.bundle-drawer-script {
  position: relative;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding: 12px 16px;
  background: var(--bg);
}
.bundle-drawer-script pre {
  font-size: 0.72rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  padding-right: 54px;
  margin: 0;
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
}
.bundle-drawer-copy {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.bundle-drawer-copy:hover { color: var(--accent); border-color: var(--accent); }
.bundle-drawer-copy.copied { color: var(--green); border-color: var(--green); }

/* ── Responsive ── */
@media (max-width: 640px) {
  header, .quickstart, .controls, .marketplace-bar, main, footer { padding-left: 16px; padding-right: 16px; }
  .view-toggle { margin-left: 0; overflow-x: auto; }
  #plugins-grid, #skills-grid, #agents-grid, #mcp-grid, #commands-grid, #hooks-grid, #bundles-grid { grid-template-columns: 1fr; }
  .step-cmd { flex-wrap: wrap; }

  /* Narrow viewports wrap source-tag chips one-per-row (long repo paths like
   * "DustyWalker/claude-code-marketplace (n)" don't fit side-by-side at
   * 412px), so the marketplace-bar grows from a single row to several. The
   * desktop-default 80px is too small here; reserve room for the loaded
   * state up front to avoid pushing <main> down. */
  .marketplace-bar { min-height: 240px; }

  /* 44×44px minimum touch target */
  .filter-btn, .sort-btn, .view-btn, .copy-btn, .expand-btn,
  .bundle-copy-btn, .panel-close-btn, .panel-copy-btn, .panel-share-btn, #panel-install-copy,
  .bundle-add-btn, .bundle-drawer-clear, .bundle-drawer-remove {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .bundle-drawer {
    right: 8px;
    bottom: 56px;
    width: calc(100vw - 16px);
  }
}
