:root {
  --bg: #0F1015;
  --surface: #1A1B23;
  --surface-2: #22232D;
  --border: #2A2B36;
  --border-strong: #3A3B47;
  --text: #E8E8EC;
  --text-2: #9799A4;
  --text-3: #6C6E78;
  --accent: #5B8DEF;
  --accent-bg: rgba(91, 141, 239, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

.container { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; }

/* Header */
header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #5B8DEF, #8B5BEF);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 15px;
}

.brand-name { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }

.nav-actions { display: flex; gap: 16px; font-size: 14px; color: var(--text-2); }
.nav-actions a:hover { color: var(--text); }

/* Hero */
.hero { margin: 8px 0 24px; }

.hero h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.hero p { margin: 0; color: var(--text-2); font-size: 15px; }

/* Search */
.search {
  position: relative;
  margin: 20px 0 18px;
}

.search input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--accent); }

.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-3);
}

.kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
}

.filters-scroll {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}

.filters-scroll::-webkit-scrollbar { display: none; }

.filters-scroll.no-overflow {
  mask-image: none;
  -webkit-mask-image: none;
}

.chip {
  padding: 7px 14px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.chip:hover { background: var(--surface-2); color: var(--text); }

.chip.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(91, 141, 239, 0.3);
}

.chip .count {
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 5px;
}

.chip.active .count { background: rgba(91, 141, 239, 0.18); color: var(--accent); }

.nav-arrow {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  transition: color 0.12s, background 0.12s, opacity 0.18s;
  padding: 0;
}

.nav-arrow:hover:not(:disabled) {
  color: var(--text);
  background: var(--border);
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.nav-arrow.hidden { display: none; }
.nav-arrow svg { width: 14px; height: 14px; }

/* Counter */
.counter {
  color: var(--text-2);
  font-size: 13.5px;
  margin: 6px 2px 16px;
}

.counter strong { color: var(--text); font-weight: 500; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: border-color 0.15s;
}

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

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.badges { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

.badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-plugin {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.badge-skill { background: rgba(74, 222, 128, 0.12); color: #4ADE80; }
.badge-agent { background: rgba(244, 114, 182, 0.12); color: #F472B6; }

.card-desc {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.55;
  flex-grow: 1;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.author {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 12.5px;
}

.avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-2);
  font-weight: 500;
}

.source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.source:hover { color: var(--text); border-color: var(--border-strong); }
.source svg { width: 12px; height: 12px; }

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

.empty p { margin: 0 0 12px; }

.empty button {
  background: var(--accent);
  border: 0;
  color: white;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* Skeleton loading */
.card.skeleton {
  pointer-events: none;
}

.skel-line {
  height: 14px;
  border-radius: 6px;
  background: var(--surface-2);
  margin-bottom: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}

.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-line.w100 { width: 100%; }
.skel-line.w40 { width: 40%; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Footer */
footer.site {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 20px 14px 40px; }

  .hero h1 { font-size: 24px; }
  .hero p { font-size: 14px; }

  /* Hide keyboard shortcut hint — irrelevant on touch */
  .kbd { display: none; }
  .search input { padding-right: 16px; }

  /* Tighten search */
  .search { margin: 16px 0 14px; }

  /* Filters: enable smooth touch scroll on iOS */
  .filters-scroll { -webkit-overflow-scrolling: touch; touch-action: pan-x; }

  /* Cards: allow more description lines on full-width single column */
  .card-desc { -webkit-line-clamp: 5; }

  /* Card footer: stack author + source on very small cards */
  .card-foot { flex-wrap: wrap; gap: 8px; }

  /* Footer: single column */
  footer.site { flex-direction: column; gap: 6px; }
}

@media (max-width: 380px) {
  /* Header: stack brand + nav on the smallest phones */
  header.site { flex-direction: column; align-items: flex-start; gap: 10px; }
  .nav-actions { font-size: 13px; }

  /* Reduce brand name size */
  .brand-name { font-size: 16px; }
}
