/* ── tokens: dark (default) ── */

:root {
  color-scheme: light dark;

  --bg-base: #08090a;
  --bg-panel: #0f1011;
  --bg-surface: #191a1b;
  --bg-elevated: #28282c;

  --text-primary: #f7f8f8;
  --text-secondary: #d0d6e0;
  --text-tertiary: #8a8f98;
  --text-quaternary: #62666d;

  --accent: #5e6ad2;
  --accent-bright: #7170ff;
  --accent-hover: #828fff;

  --border-subtle: rgba(255,255,255,0.05);
  --border-standard: rgba(255,255,255,0.08);
  --border-solid: #23252a;

  --surface-btn: rgba(255,255,255,0.02);
  --surface-btn-hover: rgba(255,255,255,0.05);

  --shadow-dropdown:
    rgba(0,0,0,0) 0px 8px 2px,
    rgba(0,0,0,0.01) 0px 5px 2px,
    rgba(0,0,0,0.04) 0px 3px 2px,
    rgba(0,0,0,0.07) 0px 1px 1px,
    rgba(0,0,0,0.08) 0px 0px 1px;

  --dialog-backdrop: rgba(0,0,0,0.85);
  --dialog-bg: #000;
  --dialog-btn-bg: rgba(255,255,255,0.1);
  --dialog-btn-bg-hover: rgba(255,255,255,0.2);

  --mark-bg: rgba(129,140,248,0.35);
  --skeleton-shimmer: rgba(255,255,255,0.10);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 9999px;
}

/* ── tokens: light ── */

@media (prefers-color-scheme: light) {
  :root {
    --bg-base: #f7f8f8;
    --bg-panel: #fff;
    --bg-surface: #fff;
    --bg-elevated: #f3f4f5;

    --text-primary: #1a1a1a;
    --text-secondary: #3b3f46;
    --text-tertiary: #6b7280;
    --text-quaternary: #9ca3af;

    --accent: #5e6ad2;
    --accent-bright: #5e6ad2;
    --accent-hover: #4f5bc4;

    --border-subtle: #e6e6e6;
    --border-standard: #d0d6e0;
    --border-solid: #d0d6e0;

    --surface-btn: rgba(0,0,0,0.02);
    --surface-btn-hover: rgba(0,0,0,0.05);

    --shadow-dropdown:
      rgba(0,0,0,0.04) 0px 8px 16px,
      rgba(0,0,0,0.02) 0px 2px 4px;

    --dialog-backdrop: rgba(0,0,0,0.5);
    --dialog-bg: #fff;
    --dialog-btn-bg: rgba(0,0,0,0.06);
    --dialog-btn-bg-hover: rgba(0,0,0,0.1);

    --mark-bg: rgba(94,106,210,0.15);
    --skeleton-shimmer: rgba(0,0,0,0.06);
  }
  .catalog-search input[type="search"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' stroke='%236b7280' stroke-width='1.5'/%3E%3Cpath d='M10 10L13.5 13.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  }
}

/* ── setup required ── */

.setup-required {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.setup-required .setup-icon {
  font-size: 3rem;
  line-height: 1;
  opacity: 0.4;
}
.setup-required h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.setup-required p {
  color: var(--text-tertiary);
  margin: 0;
}
.setup-required pre {
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  text-align: left;
}
.setup-required code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-primary);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv01', 'ss03';
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.165px;
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:visited { color: var(--accent-bright); }

mark {
  background: var(--mark-bg);
  color: var(--text-primary);
  padding: 1px 2px;
  border-radius: 2px;
}

h1 {
  font-size: 2rem;
  font-weight: 510;
  letter-spacing: -0.704px;
  line-height: 1.13;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 590;
  letter-spacing: -0.24px;
  line-height: 1.33;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
}

/* ── breadcrumb ── */

nav[aria-label="Breadcrumb"] {
  padding: 0;
  margin-bottom: 0;
}
.site-header {
  margin-bottom: 1.5rem;
}
nav[aria-label="Breadcrumb"] ol {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 960px;
  display: flex;
  gap: 0;
  font-size: 13px;
  font-weight: 510;
  line-height: 40px;
}
nav[aria-label="Breadcrumb"] li {
  color: var(--text-quaternary);
}
nav[aria-label="Breadcrumb"] li a {
  color: var(--text-tertiary);
}
nav[aria-label="Breadcrumb"] li a:hover {
  color: var(--text-primary);
}
nav[aria-label="Breadcrumb"] li + li::before {
  content: "/";
  margin: 0 8px;
  color: var(--text-quaternary);
}

/* ── catalog: search ── */

.catalog-data-completeness {
  width: 0.9em;
  margin-left: 0.35rem;
  vertical-align: -0.08em;
}
.catalog-search {
  position: relative;
  margin: 1.5rem 0 1rem;
}
.catalog-search input[type="search"] {
  width: 100%;
  padding: 10px 38px 10px 38px;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--surface-btn) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' stroke='%238a8f98' stroke-width='1.5'/%3E%3Cpath d='M10 10L13.5 13.5' stroke='%238a8f98' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px center / 16px 16px;
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.catalog-search input[type="search"]::placeholder {
  color: var(--text-tertiary);
}
.catalog-search input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.catalog-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
}
.search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
}
.search-clear:hover {
  color: var(--text-primary);
  background: var(--surface-btn-hover);
}
.search-clear svg {
  width: 14px;
  height: 14px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
}
.suggestions li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 510;
  color: var(--text-secondary);
  text-align: left;
}
.suggestion-thumb {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-btn);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 13px;
  font-weight: 510;
  color: var(--text-tertiary);
}
.suggestion-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  visibility: hidden;
}
.suggestion-text {
  min-width: 0;
}
.suggestions li.selected {
  background: var(--surface-btn-hover);
  color: var(--text-primary);
}
.suggestion-desc {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-quaternary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* ── catalog: filters ── */

.catalog-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.catalog-filters select,
.catalog-toolbar select {
  font: inherit;
  font-size: 13px;
  font-weight: 510;
  width: 200px;
  color: var(--text-secondary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}
.catalog-filters select:focus,
.catalog-toolbar select:focus {
  border-color: var(--accent);
}
.catalog-filters .filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 510;
  color: var(--text-secondary);
  cursor: pointer;
}
.catalog-filters .filter-check input {
  accent-color: var(--accent);
  cursor: pointer;
}
.catalog-toolbar output {
  color: var(--text-quaternary);
  font-size: 13px;
  font-weight: 510;
  margin-left: auto;
}
.clear-filters {
  font: inherit;
  font-size: 12px;
  font-weight: 510;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  cursor: pointer;
}
.clear-filters:hover {
  color: var(--text-primary);
  border-color: var(--text-quaternary);
}
.catalog-more {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 0;
}
.catalog-more button {
  font: inherit;
  font-size: 13px;
  font-weight: 510;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  cursor: pointer;
}
.catalog-more button:hover {
  color: var(--text-primary);
  border-color: var(--text-quaternary);
}

/* ── catalog: results ── */

.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-tertiary);
  padding: 2rem 0;
  text-align: center;
}
.no-results .clear-filters {
  padding: 8px 16px;
  font-size: 13px;
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  border-radius: var(--radius-md);
}
.no-results .clear-filters:hover {
  color: #fff;
  background: var(--accent-hover);
  border-color: transparent;
}

.catalog-results article {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 160px;
  column-gap: 1rem;
  row-gap: 0.5rem;
  align-items: start;
  padding: 1.15rem 0.85rem;
  margin: 0 -0.85rem;
  border-top: 1px solid var(--border-subtle);
  content-visibility: auto;
  contain-intrinsic-size: auto 104px;
}
.catalog-results article:not(:has(figure)) {
  grid-template-columns: minmax(0, 1fr) auto 160px;
}
.catalog-results article figure {
  position: relative;
  margin: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-btn);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}
.catalog-results article figure .logo-placeholder {
  font-size: 22px;
  font-weight: 510;
  color: var(--text-tertiary);
  letter-spacing: -0.5px;
}
.catalog-results article figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  visibility: hidden;
}
.catalog-results article header { display: block; }
.catalog-results article header h2 {
  font-size: 15px;
  font-weight: 510;
  letter-spacing: -0.165px;
  margin: 0;
  line-height: 1.4;
}
.catalog-results article header h2 a {
  color: var(--text-primary);
}
.catalog-results article header h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
}
.catalog-results article:has(h2 a:hover) {
  background: var(--surface-btn);
  border-radius: var(--radius-md);
}
.catalog-results article:has(.activity-score-panel) {
  z-index: 2;
}
.catalog-results article.is-score-open {
  z-index: 10;
  content-visibility: visible;
}
.catalog-results article:has(> .catalog-badge) {
  padding-top: 2.25rem;
}
.catalog-results article > .catalog-badge {
  position: absolute;
  z-index: 1;
  top: 0.55rem;
  left: 0.85rem;
  margin-left: 0;
}
.catalog-results article header h2 a:hover {
  color: var(--accent-bright);
}
.catalog-results article header p {
  margin: 2px 0 6px;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.5;  hyphens: auto;
}
.catalog-results article footer {
  position: relative;
  z-index: 1;
  grid-column: 1 / 4;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  font-size: 13px;
  color: var(--text-quaternary);
  text-align: left;
}
.catalog-results article footer::before,
.catalog-results article footer::after { content: none; }
.activity-index {
  position: relative;
  z-index: 1;
  grid-column: 4;
  grid-row: 1 / span 2;
  align-self: stretch;
  box-sizing: border-box;
  width: 160px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem 0 1rem;
  border-left: 1px solid var(--border-standard);
  text-align: center;
}
.activity-index.is-loading {
  gap: 8px;
}
.activity-index-skeleton-label,
.activity-index-skeleton-value {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-btn) 25%, var(--surface-btn-hover) 50%, var(--surface-btn) 75%);
  background-size: 200% 100%;
  animation: activity-index-shimmer 1.2s ease-in-out infinite;
}
.activity-index-skeleton-label {
  width: 76px;
  height: 10px;
}
.activity-index-skeleton-value {
  width: 44px;
  height: 31px;
}
@keyframes activity-index-shimmer {
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .activity-index-skeleton-label,
  .activity-index-skeleton-value { animation: none; }
}
.catalog-results article:not(:has(figure)) .activity-index {
  grid-column: 3;
}
.catalog-results article:not(:has(figure)) footer {
  grid-column: 1 / 3;
}
.activity-index-label {
  font-size: 10px;
  font-weight: 510;
  letter-spacing: 0.3px;
  color: var(--text-quaternary);
  text-transform: uppercase;
  white-space: nowrap;
}
.activity-index-label-text { white-space: nowrap; }
.activity-index-value {
  display: grid;
  grid-template-columns: max-content 18px;
  align-items: center;
  column-gap: 4px;
}
.activity-custom-toggle,
.activity-custom-toggle-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: -4px;
  padding: 0;
  color: var(--accent-bright);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.activity-custom-toggle:hover,
.activity-custom-toggle:focus-visible {
  color: var(--text-primary);
  background: var(--surface-btn-hover);
}
.activity-custom-toggle-placeholder {
  cursor: default;
}
.activity-badge {
  display: block;
  margin-top: 2px;
  color: var(--accent-bright);
  font-size: 2rem;
  font-weight: 590;
  letter-spacing: -0.5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.activity-badge.is-na {
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}
.activity-badge.is-na svg {
  font-size: 20px;
}
.activity-score-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  box-sizing: border-box;
  width: min(760px, calc(100vw - 2rem));
  overflow: visible;
  margin: 0;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown), 0 10px 24px rgba(0, 0, 0, 0.16);
}
.activity-score-panel::before {
  content: none;
  position: absolute;
  top: -8px;
  right: 21px;
  width: 16px;
  height: 8px;
  background: var(--bg-surface);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.activity-score-pointer {
  position: absolute;
  z-index: 1;
  top: -8px;
  right: 10px;
  width: 14px;
  height: 8px;
  display: block;
  overflow: visible;
}
.activity-score-pointer path {
  fill: var(--bg-surface);
  stroke: var(--border-standard);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.activity-score-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -0.2rem 0 0.7rem;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 590;
}
.activity-score-panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.activity-score-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -0.25rem -0.25rem -0.25rem 0;
  padding: 0;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.activity-score-close:hover,
.activity-score-close:focus-visible {
  color: var(--text-primary);
  background: var(--surface-btn-hover);
}
.activity-score-panel p {
  margin: 0 0 0.75rem;
  color: var(--text-tertiary);
  font-size: 13px;
}
.activity-score-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.activity-score-panel th {
  padding: 5px 8px;
  color: var(--text-quaternary);
  font-size: 10px;
  font-weight: 510;
  letter-spacing: 0.3px;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-standard);
}
.activity-score-panel td {
  padding: 7px 8px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}
.activity-score-panel td:first-child {
  color: var(--text-primary);
  font-weight: 510;
  font-variant-numeric: normal;
}
.activity-score-panel tr:last-child td {
  border-bottom: none;
}
.activity-score-panel .is-na {
  color: var(--text-quaternary);
}
.activity-score-panel .weight-input {
  width: 44px;
  padding: 4px 6px;
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  outline: none;
}
.activity-score-panel .weight-input:focus {
  border-color: var(--accent);
}
.activity-score-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-standard);
}
.activity-score-options label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
}
.activity-score-options select {
  width: 100%;
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
}
.activity-score-splits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.activity-score-splits section {
  padding: 0.7rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}
.activity-score-splits h4 {
  margin: 0 0 0.55rem;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 510;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.activity-score-splits label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
}
.activity-score-splits label + label {
  margin-top: 6px;
}
.activity-score-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0.65rem;
  padding-top: 0.2rem;
}
.activity-score-actions button {
  min-width: 64px;
  padding: 8px 16px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.activity-score-actions button:hover,
.activity-score-actions button:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.activity-score-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  font: inherit;
  font-size: 10px;
  color: var(--text-tertiary);
  background: transparent;
  border-color: var(--border-solid);
  border-style: solid;
  border-width: 1px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.activity-score-reset:hover,
.activity-score-reset:focus-visible {
  color: var(--text-primary);
  background: var(--surface-btn-hover);
  border-color: var(--text-quaternary);
}
.activity-badge.is-custom {
  color: #c0bfbc;
}
.activity-badge.is-capped-unknown {
  color: #c86e66;
}
@media (prefers-color-scheme: light) {
  .activity-badge.is-custom {
    color: #c0bfbc;
  }
}
.activity-unavailable {
  margin: 0;
  color: var(--text-tertiary);
  font-style: italic;
}
.activity-scope {
  margin: 0 0 4px;
  color: var(--text-tertiary);
  font-size: 0.85em;
}
.activity-scope.activity-cap-warning {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c86e66;
}
.activity-settings .settings-intro {
  margin: 0 0 1rem;
  color: var(--text-tertiary);
  font-size: 14px;
}
.settings-preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  background: var(--surface-btn);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
}
.settings-preference > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-preference strong {
  font-size: 13px;
  font-weight: 510;
}
.settings-preference small {
  color: var(--text-tertiary);
  font-size: 12px;
}
.settings-switch {
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  padding: 2px;
  background: var(--text-quaternary);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.15s;
}
.settings-switch > span {
  display: block;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s;
}
.settings-switch.is-on { background: var(--accent); }
.settings-switch.is-on > span { transform: translateX(16px); }
.settings-switch:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.catalog-results .categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.catalog-results .categories li {
  font-size: 11px;
  font-weight: 510;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.catalog-results .categories li + li::before { content: none; }
.catalog-results .categories li:hover {
  color: var(--text-primary);
  background: var(--surface-btn-hover);
  border-color: var(--text-quaternary);
}
.catalog-results .license { color: var(--accent-bright); }
.catalog-results .card-date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.catalog-results .catalog-badge {
  font-size: 11px;
  font-weight: 510;
  padding: 0;
  color: var(--text-quaternary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── detail: header ── */

.software-detail header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.software-detail header > div { flex: 1; min-width: 0; }
.software-detail .software-logo {
  position: relative;
  margin: 0;
  padding: 5px;
  box-sizing: border-box;
  height: 5rem;
  width: 5rem;
  max-width: 12rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-btn);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.software-detail .software-logo .logo-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 510;
  color: var(--text-tertiary);
  letter-spacing: -0.5px;
}
.software-detail .software-logo.image-loaded {
  background: transparent;
}
.software-detail .software-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.software-detail header h1 {
  font-size: 2rem;
  font-weight: 510;
  letter-spacing: -0.704px;
}
.software-detail header h1 small {
  font-weight: 400;
  color: var(--text-quaternary);
  font-size: 0.9rem;
}
.software-detail .short-description {
  font-size: 1.06rem;
  color: var(--text-tertiary);
  margin: 0.25rem 0 1rem;
}
.software-detail header .categories {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.software-detail header .categories li a {
  font-size: 11px;
  font-weight: 510;
  background: transparent;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
}
.software-detail header .categories li a:hover {
  color: var(--text-primary);
  border-color: var(--text-quaternary);
}

/* ── detail: action links ── */

.software-links {
  display: flex;
  gap: 8px;
  margin: 1rem 0 0;
}
.software-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 510;
}
.software-links a:first-child {
  background: var(--accent);
  color: #fff;
}
.software-links a:first-child:hover {
  background: var(--accent-hover);
}
.software-links a:not(:first-child) {
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  color: var(--text-secondary);
}
.software-links a:not(:first-child):hover {
  background: var(--surface-btn-hover);
  color: var(--text-primary);
}
.software-links a + a::before { content: none; }

/* ── detail: metadata ── */

.software-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 32px;
  align-items: baseline;
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--surface-btn);
  border-radius: var(--radius-lg);
}
.software-meta dt {
  font-size: 12px;
  font-weight: 510;
  color: var(--text-quaternary);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.software-meta dd {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  overflow-wrap: break-word;
}
.software-meta dd a { color: var(--accent-bright); }

/* ── detail: sections ── */

.software-detail section {
  margin-top: 0;
}
.software-detail section h2 {
  font-size: 1.13rem;
  font-weight: 590;
  letter-spacing: -0.165px;
  color: var(--text-primary);
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.software-detail section h2 svg {
  margin-right: 0.4em;
  opacity: 0.5;
}
.software-metrics-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.software-detail section .software-metrics-head h2 {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.software-metrics-overview {
  font-size: 13px;
  font-weight: 510;
  color: var(--accent-bright);
  white-space: nowrap;
}
.software-detail section ul {
  margin: 0.5rem 0;
  padding-left: 20px;
  color: var(--text-secondary);
}
.software-detail section li {
  margin-bottom: 4px;
  font-size: 14px;
}

.software-features ul {
  columns: 2;
  column-gap: 2rem;
}

.software-description {
  max-width: 72ch;
  line-height: 1.7;
  color: var(--text-secondary);
}
.software-description img {
  max-width: 100%;
  border-radius: var(--radius-lg);
}

/* ── lightbox ── */

.screenshot-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.screenshot-thumb {
  padding: 0;
  width: 260px;
  height: 160px;
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
  background: var(--surface-btn);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
}
.screenshot-thumb:hover {
  border-color: var(--accent-bright);
}
.screenshot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  background: var(--dialog-bg);
  max-width: 90vw;
  max-height: 90vh;
}
dialog::backdrop {
  background: var(--dialog-backdrop);
}
dialog img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
}
dialog nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  padding: 0 8px;
  pointer-events: none;
}
dialog nav button {
  pointer-events: auto;
  background: var(--dialog-btn-bg);
  border: 1px solid var(--border-standard);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.2rem;
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(8px);
}
dialog nav button:hover {
  background: var(--dialog-btn-bg-hover);
}
#lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  pointer-events: auto;
  background: var(--dialog-btn-bg);
  border: 1px solid var(--border-standard);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
  backdrop-filter: blur(8px);
}
#lightbox-close:hover {
  background: var(--dialog-btn-bg-hover);
}

/* ── license popover ── */

.license-trigger {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-bright);
  cursor: pointer;
  font: inherit;
  text-decoration: underline dotted;
}
.license-trigger:hover { color: var(--accent-hover); }

[popover] {
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-width: 320px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-dropdown);
}
[popover] h3 {
  margin: 0 0 0.75rem;
  font-size: 15px;
  font-weight: 590;
  color: var(--text-primary);
}
[popover] dt {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-quaternary);
  font-weight: 510;
  margin-top: 0.5rem;
  letter-spacing: 0.3px;
}
[popover] dd {
  margin: 2px 0 0;
  font-size: 13px;
}

.image-shell,
.screenshot-thumb {
  position: relative;
}

.image-loading .logo-placeholder {
  visibility: hidden;
}

.image-loading::after,
.image-skeleton {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shimmer), transparent);
  background-size: 220% 100%;
  animation: image-placeholder 1.2s ease-in-out infinite;
}

.screenshot-thumb .image-skeleton {
  display: block;
  background-color: var(--surface-btn);
}

@keyframes image-placeholder {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* ── detail: activity metrics & score ── */

.software-metrics .metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.metrics-group {
  background: var(--surface-btn);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.metrics-group h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-quaternary);
  font-weight: 510;
  margin: 0 0 0.75rem;
}
.metrics-group dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 1rem;
  margin: 0;
}
.metrics-group dt {
  font-size: 13px;
  color: var(--text-tertiary);
}
.metrics-group dd {
  margin: 0;
  font-size: 13px;
  font-weight: 510;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.metrics-group dd.is-na {
  color: var(--text-quaternary);
  font-weight: 400;
}
.metrics-group dd a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-quaternary);
  text-underline-offset: 2px;
}
.metrics-group dd a:hover,
.metrics-group dd a:focus-visible {
  color: var(--accent-bright);
  text-decoration-color: currentColor;
}
.activity-catalog {
  margin-bottom: 2rem;
}
.activity-meta {
  font-size: 13px;
  color: var(--text-tertiary);
}
.activity-distribution {
  width: 100%;
}

.activity-score-badge {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.25rem;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface-btn);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
}
.activity-score-badge.is-expanded {
  row-gap: 0;
}
.activity-label {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 510;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-quaternary);
}
.activity-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.activity-value {
  font-size: 2.5rem;
  font-weight: 590;
  letter-spacing: -0.704px;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.activity-max {
  font-size: 0.9rem;
  color: var(--text-quaternary);
}
.activity-score-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-title {
  font-size: 13px;
  font-weight: 510;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.activity-title abbr {
  color: var(--text-quaternary);
  text-decoration: none;
  cursor: help;
}
.activity-weights-toggle {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 510;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-standard);
  padding: 0.75rem 0 0;
  cursor: pointer;
}
.activity-weights-toggle:hover,
.activity-weights-toggle:focus-visible {
  color: var(--accent-bright);
}
.activity-value.is-custom {
  color: #c0bfbc;
}
.activity-value.is-capped-unknown {
  color: #c86e66;
}
.activity-weights-toggle svg {
  transition: transform 0.15s;
}
.activity-weights-toggle svg.rot {
  transform: rotate(180deg);
}
.activity-weights-panel {
  grid-column: 1 / -1;
  padding-top: 0.75rem;
}
.activity-score-badge.is-loading,
.activity-settings.is-loading {
  visibility: hidden;
}
.activity-weights-panel .activity-debug {
  margin-top: 0;
}
.activity-collected-at {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.activity-debug {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 13px;
}
.activity-debug th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-quaternary);
  font-weight: 510;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-standard);
}
.activity-debug td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.activity-debug td:first-child {
  color: var(--text-primary);
  font-weight: 510;
  font-variant-numeric: normal;
}
.activity-debug .bar-track {
  display: inline-block;
  vertical-align: middle;
  width: 60px;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-right: 8px;
}
.activity-debug .bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
}
.activity-debug tr.is-excluded td,
.activity-debug .is-na {
  color: var(--text-quaternary);
}
.activity-debug abbr {
  cursor: help;
  color: var(--text-quaternary);
  text-decoration: none;
}
.activity-debug tfoot td {
  font-weight: 590;
  color: var(--text-primary);
  border-bottom: none;
}
.activity-debug .weight-input {
  width: 64px;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.activity-debug .weight-input:focus {
  border-color: var(--accent);
}
.activity-split-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 510;
  color: var(--text-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.activity-split-toggle svg {
  font-size: 10px;
  color: var(--text-quaternary);
  transition: transform 0.15s;
}
.activity-split-toggle svg.rot {
  transform: rotate(180deg);
}
.activity-split-row td {
  padding: 0;
}
.activity-split {
  display: flex;
  gap: 16px;
  padding: 10px 8px 12px 28px;
  background: var(--bg-elevated);
}
.activity-split label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.activity-split input {
  width: 64px;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.activity-split input:focus {
  border-color: var(--accent);
}

.activity-config {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.activity-config fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}
.activity-config legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-quaternary);
  font-weight: 510;
  padding: 0 6px;
}
.activity-config .weight-sum {
  text-transform: none;
  color: var(--text-tertiary);
  margin-left: 8px;
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.config-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.config-grid input,
.config-grid select {
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  outline: none;
}
.config-grid input:focus,
.config-grid select:focus {
  border-color: var(--accent);
}
.activity-reset {
  font: inherit;
  font-size: 12px;
  font-weight: 510;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  cursor: pointer;
}
.activity-reset:hover {
  color: var(--text-primary);
  border-color: var(--text-quaternary);
}
.activity-override {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0;
  font-size: 12px;
  font-weight: 510;
  color: var(--accent-bright);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 3px 6px 3px 10px;
}
.activity-override button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 11px;
  color: var(--accent-bright);
  background: transparent;
  border: none;
  border-left: 1px solid var(--accent);
  padding: 0 0 0 6px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.activity-override:hover button,
.activity-override button:focus-visible {
  opacity: 1;
}
.weight-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.weight-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--surface-btn);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.weight-stepper button:hover {
  color: var(--text-primary);
  border-color: var(--text-quaternary);
}
.weight-stepper .weight-input {
  width: 44px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.weight-stepper .weight-input::-webkit-outer-spin-button,
.weight-stepper .weight-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.catalog-flag {
  margin-right: 0.35em;
}

.software-meta .platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em 1em;
}
.software-meta .platform {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}
.software-meta .platform svg {
  width: 1em;
  height: 1em;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .catalog-results article {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .catalog-results article:not(:has(figure)) {
    grid-template-columns: minmax(0, 1fr);
  }
  .catalog-results article .activity-index,
  .catalog-results article:not(:has(figure)) .activity-index {
    grid-column: 1 / -1;
    grid-row: 2;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.5rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
    text-align: left;
  }
  .catalog-results article footer,
  .catalog-results article:not(:has(figure)) footer {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .catalog-toolbar select {
    width: auto;
    max-width: 100%;
  }
}
