:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-muted: #f7f7f7;
  --border: #e2e2e2;
  --border-strong: #111111;
  --text: #111111;
  --text-muted: #5f5f5f;
  --shadow: 0 8px 24px rgba(17, 17, 17, 0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --popup-width: 380px;
  --footer-height: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: var(--popup-width);
  min-width: var(--popup-width);
  max-width: var(--popup-width);
  height: 600px;
  max-height: 600px;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  display: flex;
  flex-direction: column;
}

.app-shell {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 18px;
}

.header,
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-icon {
  display: block;
  flex-shrink: 0;
}

.header {
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.site-panel {
  padding: 14px;
}

.site-panel {
  margin-bottom: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.site-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status-strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #e9e9e9;
  overflow: hidden;
}

.progress-bar {
  width: 8%;
  height: 100%;
  border-radius: 999px;
  background: #111111;
  transition:
    width 220ms ease,
    opacity 180ms ease;
}

.status-text,
.site-meta,
.result-count,
.description,
.source {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-text {
  min-height: 17px;
  font-size: 12px;
  line-height: 1.4;
}

.site-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.results-section.hidden,
.link-button.hidden {
  display: none;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.result-card:hover,
.result-card:focus-visible {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.result-card:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.result-card:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.result-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.result-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.catalog-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.catalog-icon::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background-color: transparent;
  background-image: var(--catalog-icon-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.catalog-icon-fallback {
  position: relative;
  z-index: 0;
}

.catalog-icon-skillssh {
  background: #f3f3f3;
  color: #111111;
}

.catalog-icon-clawhub {
  background: #ffffff;
  border-color: #d8d8d8;
  color: #111111;
}

.catalog-icon-mcpmarket {
  background: #ffffff;
  border-color: #d8d8d8;
  color: #111111;
}

.catalog-icon-default {
  background: #ececec;
  color: #111111;
}

.result-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.official-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 1px solid #bfe8cf;
  border-radius: 999px;
  background: #e8f7ee;
  color: #137a3a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.rank-badge {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.description {
  margin-bottom: 10px;
  min-height: 40px;
  overflow-wrap: anywhere;
}

.source {
  font-family:
    ui-monospace,
    SFMono-Regular,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 12px;
  min-height: 18px;
  overflow-wrap: anywhere;
}

.icon-button,
.link-button,
.donate-button {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #111111;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 12px;
  text-decoration: none;
}

.donate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  flex-shrink: 0;
  border-color: var(--border);
  background: #f3f3f3;
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 9px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 0;
}

.refresh-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.copy-icon-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.copy-icon-placeholder {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 999px;
}

.copy-icon-placeholder-empty {
  visibility: hidden;
}

.skeleton {
  background: #eeeeee;
}

.icon-button:hover,
.link-button:hover,
.donate-button:hover,
.copy-icon-button:hover {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
}

.icon-button:focus-visible,
.link-button:focus-visible,
.donate-button:focus-visible,
.copy-icon-button:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.window-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--footer-height);
  flex-shrink: 0;
  padding: 7px 16px;
  border-top: 1px solid var(--border);
  background: rgba(247, 247, 247, 0.92);
  box-shadow: 0 -10px 24px rgba(17, 17, 17, 0.04);
  backdrop-filter: blur(14px);
}

.empty-state {
  padding: 10px 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}
