/* Agent-specific content inside the same shell, filters, and sidebar as Skills. */
.agent-library-page .agent-main-column {
  min-width: 0;
}

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

.agent-library-page .agent-skip:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 99;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 16px;
  clip: auto;
  border-radius: 8px;
  color: var(--ui-blue);
  background: var(--ui-surface);
}

.agent-library-page .agent-result-line a {
  color: var(--ui-blue);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.agent-library-page .agent-result-line a:hover,
.agent-library-page .agent-source-link:hover {
  text-decoration: underline;
}

.agent-library-page #agent-view-toggle {
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  white-space: nowrap;
}

.agent-library-page #agent-view-toggle:hover,
.agent-library-page #agent-view-toggle[aria-pressed="true"] {
  color: var(--ui-blue);
  background: var(--ui-selected);
}

/* Cards use the Skills gallery grid while keeping Agent-specific evidence visible. */
.agent-library-page .agent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 245px;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 15px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.agent-library-page .agent-card[hidden],
.agent-library-page .agent-empty[hidden] {
  display: none;
}

.agent-library-page .agent-card:hover {
  transform: translateY(-3px);
  border-color: var(--ui-control-line);
  box-shadow: 0 10px 26px #1d1d1f0c;
}

.agent-library-page .agent-card-hit {
  position: absolute;
  z-index: 1;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.agent-library-page .agent-card-hit:focus-visible {
  outline: 3px solid var(--ui-blue);
  outline-offset: -3px;
}

.agent-library-page .agent-card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 57px;
  padding: 14px 48px 0 18px;
}

.agent-library-page .agent-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 10px;
  color: var(--agent-accent, var(--ui-blue));
  background: color-mix(in srgb, var(--agent-accent, var(--ui-blue)) 14%, var(--ui-surface));
  font-size: 15px;
  font-weight: 700;
}

.agent-library-page .agent-card-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.agent-library-page .agent-kind,
.agent-library-page .agent-heat,
.agent-library-page .agent-rank-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.agent-library-page .agent-kind.is-microsoft,
.agent-library-page .agent-rank-badge {
  color: var(--ui-blue);
  background: var(--ui-selected);
}

.agent-library-page .agent-kind.is-third-party {
  color: #6741b9;
  background: #f3efff;
}

.agent-library-page .agent-heat {
  color: #835900;
  background: #fff3dd;
}

.agent-library-page .agent-favorite {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ui-muted);
  background: transparent;
  font-size: 23px;
  line-height: 1;
}

.agent-library-page .agent-favorite:hover,
.agent-library-page .agent-favorite.is-saved {
  color: #a97416;
  background: var(--ui-subtle);
}

.agent-library-page .agent-card h2 {
  margin: 14px 18px 3px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.agent-library-page .agent-provider {
  margin: 0 18px;
  color: var(--ui-muted);
  font-size: 12px;
}

.agent-library-page .agent-apps {
  margin: 7px 18px 0;
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-library-page .agent-apps-label {
  color: var(--ui-muted);
}

.agent-library-page .agent-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin: 10px 18px 15px;
  color: var(--ui-muted);
  font-size: 14px;
  line-height: 1.65;
}

.agent-library-page .agent-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: auto;
  padding: 11px 18px;
  border-top: 1px solid var(--ui-line);
  color: var(--ui-muted);
  font-size: 12px;
}

.agent-library-page .agent-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-library-page .agent-card-links {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  white-space: nowrap;
}

.agent-library-page .agent-source-link {
  color: var(--ui-blue);
  text-decoration: none;
}

.agent-library-page .agent-source-language {
  color: var(--ui-muted);
}

.agent-library-page .agent-grid.is-compact .agent-card {
  min-height: 178px;
}

.agent-library-page .agent-grid.is-compact .agent-summary {
  display: none;
}

.agent-library-page .agent-empty {
  grid-column: 1 / -1;
  min-height: 280px;
  padding: 48px 24px;
  border: 1px dashed var(--ui-line);
  border-radius: 15px;
  color: var(--ui-muted);
  text-align: center;
}

.agent-library-page .agent-empty-icon {
  font-size: 36px;
  line-height: 1;
}

.agent-library-page .agent-empty h2 {
  margin: 10px 0 5px;
  color: var(--ui-ink);
  font-size: 19px;
}

.agent-library-page .agent-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.agent-library-page .agent-empty button {
  min-height: 36px;
  margin-top: 17px;
  padding: 8px 14px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  color: var(--ui-blue);
  background: var(--ui-surface);
}

/* The leaderboard follows the Skills sidebar typography and row rhythm. */
.agent-library-page .agent-ranking-list,
.agent-library-page .agent-ranking-side-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-library-page .agent-ranking-list li,
.agent-library-page .agent-ranking-side-list li {
  min-width: 0;
  border-bottom: 1px solid var(--ui-line);
}

.agent-library-page .agent-ranking-list li:last-child,
.agent-library-page .agent-ranking-side-list li:last-child {
  border-bottom: 0;
}

.agent-library-page .agent-ranking-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 13px 0;
  border: 0;
  color: var(--ui-ink);
  background: transparent;
  text-align: left;
}

.agent-library-page .agent-ranking-item:hover {
  color: var(--ui-blue);
}

.agent-library-page .agent-ranking-item em {
  margin-left: auto;
  color: var(--ui-blue);
  font-size: 13px;
  font-style: normal;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.agent-library-page .agent-ranking-rank {
  display: inline-block;
  flex: 0 0 27px;
  width: 27px;
  color: var(--ui-muted);
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.agent-library-page .agent-ranking-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.agent-library-page .agent-ranking-title {
  overflow: hidden;
  color: var(--ui-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-library-page .agent-ranking-meta {
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-library-page .agent-ranking-score {
  margin-left: auto;
  color: var(--ui-blue);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.8;
  font-variant-numeric: tabular-nums;
}

.agent-library-page .agent-sidebar-note,
.agent-library-page .agent-ranking-note {
  margin: 12px 0 0;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.7;
}

.agent-library-page .agent-app-guide-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.agent-library-page .agent-app-guide-list span {
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--ui-muted);
  background: var(--ui-surface);
  font-size: 11px;
}

/* Detail dialog uses the same surface and text scale as the Skills dialog. */
.agent-library-page .agent-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  box-shadow: 0 24px 100px #0003;
}

.agent-library-page .agent-dialog::backdrop {
  background: #161c2260;
  backdrop-filter: blur(5px);
}

.agent-library-page .agent-dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-muted);
  font-size: 13px;
}

.agent-library-page .agent-dialog-top button {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ui-ink);
  background: var(--ui-subtle);
  font-size: 23px;
  line-height: 1;
}

.agent-library-page .agent-dialog-inner {
  padding: 20px 24px 24px;
}

.agent-library-page .agent-dialog-inner .agent-card-top {
  padding: 0;
}

.agent-library-page .agent-dialog-inner h2 {
  margin: 12px 0 0;
  font-size: 24px;
  line-height: 1.35;
}

.agent-library-page .agent-dialog-provider {
  margin: 5px 0 0;
  color: var(--ui-muted);
  font-size: 13px;
}

.agent-library-page .agent-dialog-inner > p:not(.agent-dialog-provider) {
  margin: 18px 0 0;
  color: var(--ui-muted);
  font-size: 14px;
  line-height: 1.75;
}

.agent-library-page .agent-dialog-inner h3 {
  margin: 20px 0 9px;
  font-size: 15px;
}

.agent-library-page .agent-dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 17px;
}

.agent-library-page .agent-dialog-meta span {
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--ui-muted);
  background: var(--ui-subtle);
  font-size: 12px;
}

.agent-library-page .agent-dialog-guide {
  margin: 0;
  padding-left: 22px;
  color: var(--ui-muted);
  font-size: 13px;
  line-height: 1.7;
}

.agent-library-page .agent-dialog-guide li {
  padding: 3px 0;
}

.agent-library-page .agent-dialog-inner .agent-dialog-note {
  padding: 11px 13px;
  border-left: 3px solid var(--ui-primary);
  border-radius: 0 7px 7px 0;
  background: var(--ui-subtle);
  font-size: 12px;
  line-height: 1.6;
}

.agent-library-page .agent-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.agent-library-page .agent-dialog-actions a,
.agent-library-page .agent-dialog-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  font-size: 13px;
  text-decoration: none;
}

.agent-library-page .agent-dialog-actions a {
  border-color: var(--ui-primary);
  color: #fff;
  background: var(--ui-primary);
}

.agent-library-page .agent-dialog-actions a:hover {
  background: var(--ui-primary-hover);
}

.agent-library-page .agent-toast {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  padding: 10px 14px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
  font-size: 13px;
}

.agent-library-page .agent-toast[hidden] {
  display: none;
}

html[data-theme="dark"] .agent-library-page .agent-kind.is-third-party {
  color: #d6c7ff;
  background: #382b58;
}

html[data-theme="dark"] .agent-library-page .agent-heat {
  color: #f2d793;
  background: #554121;
}

@media (max-width: 720px) {
  .agent-library-page .agent-card {
    min-height: 230px;
  }

  .agent-library-page .agent-card-top {
    padding-left: 16px;
  }

  .agent-library-page .agent-card h2,
  .agent-library-page .agent-provider,
  .agent-library-page .agent-apps,
  .agent-library-page .agent-summary {
    margin-right: 16px;
    margin-left: 16px;
  }

  .agent-library-page .agent-card-foot {
    padding-inline: 16px;
  }

}

@media (max-width: 580px) {
  .agent-library-page .agent-result-line a {
    white-space: normal;
  }

  .agent-library-page .agent-card-foot {
    flex-wrap: wrap;
  }

  .agent-library-page .agent-dialog-inner {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-library-page .agent-card {
    transition: none;
  }

  .agent-library-page .agent-card:hover {
    transform: none;
  }
}
