:root {
  color-scheme: dark;
  --bg: #030303;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --text: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.36);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #fe6e00;
  --accent-soft: rgba(254, 110, 0, 0.14);
}

* {
  box-sizing: border-box;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

:where(a, button, input, select, textarea, label, summary, [role="button"]) {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

:where(button, select, textarea) {
  -webkit-appearance: none;
  appearance: none;
}

:where(a, button, input, select, textarea, .filter-pill, .dropdown-trigger, .dropdown-option, .reset-btn):focus {
  outline: none;
}

:where(a, button, input, select, textarea, .filter-pill, .dropdown-trigger, .dropdown-option, .reset-btn):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:where(.filter-pill, .dropdown-trigger, .dropdown-option, .reset-btn, .hero-cta):active {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.repo-card:active {
  background: transparent;
}

.repo-card:active .repo-name {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans CJK SC", sans-serif;
  line-height: 1.45;
}

.page {
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.hero--detail {
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand::before {
  content: "";
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  background: url("/assets/logo.svg") center / contain no-repeat;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: color .15s ease;
}

.hero-cta:hover {
  color: var(--accent);
}

.catalog-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.list-hint {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}

.search {
  position: relative;
  display: block;
}

.search-icon {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: var(--faint);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

input {
  color: var(--text);
  font: inherit;
  outline: none;
}

input {
  width: 100%;
  height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0 0 0 32px;
  line-height: normal;
}

input::placeholder { color: var(--faint); }
input:focus {
  border-color: var(--accent);
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  justify-content: space-between;
}

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

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.filter-pill:hover {
  color: var(--text);
}

.filter-pill.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.control-dropdown {
  display: inline-flex;
  align-items: center;
}

.dropdown {
  position: relative;
  min-width: 0;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}

.dropdown-trigger:hover {
  color: var(--text);
}

.dropdown-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-chevron {
  position: relative;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
}

.dropdown-chevron::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg);
  transition: transform .18s ease, border-color .18s ease;
}

.dropdown.is-open .dropdown-chevron::before {
  top: 7px;
  transform: rotate(-135deg);
  border-color: var(--accent);
}

.dropdown.is-open .dropdown-trigger {
  color: var(--accent);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: min(240px, calc(100vw - 48px));
  max-height: min(280px, 42vh);
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #0b0b0b;
  list-style: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.dropdown-menu[hidden] {
  display: none;
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.dropdown-option:hover,
.dropdown-option:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.dropdown-option.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.dropdown-option.is-selected::after {
  content: "✓";
  margin-left: auto;
  padding-left: 12px;
  font-size: 13px;
  font-weight: 800;
}

.repo-list {
  display: block;
}

.repo-section + .repo-section {
  margin-top: 24px;
}

.section-title {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.repo-grid {
  display: flex;
  flex-direction: column;
}

.repo-grid--flat {
  margin-top: 4px;
}

.repo-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 4px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: color .15s ease;
}

.repo-grid .repo-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.repo-card:hover .repo-name {
  color: var(--accent);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  flex: 0 0 40px;
}

.repo-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.repo-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.repo-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  line-height: 1;
}

.metric--stars { color: var(--accent); }
.metric--lang {
  color: var(--faint);
}


.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0 16px;
  text-align: center;
}

.empty-title {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.skeleton-card,
.skeleton-section {
  pointer-events: none;
}

.skeleton-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.skeleton-block {
  position: relative;
  display: block;
  overflow: hidden;
  width: var(--w, 100%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.075), transparent);
  animation: skeleton-sweep 1.35s ease-in-out infinite;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: 0 0 40px;
}

.skeleton-name {
  height: 18px;
  margin-bottom: 8px;
}

.skeleton-owner {
  height: 13px;
}

.skeleton-desc {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-desc.short {
  width: 72%;
}

.skeleton-tags {
  display: flex;
  gap: 8px;
}

.skeleton-tag {
  width: 72px;
  height: 26px;
}

.skeleton-footer {
  display: flex;
  gap: 10px;
}

.skeleton-metric {
  width: 64px;
  height: 24px;
}

.skeleton-section-title {
  width: 180px;
  height: 30px;
  border-radius: 12px;
}

.skeleton-section-count {
  width: 42px;
  height: 28px;
}

.skeleton-back {
  width: 128px;
  height: 14px;
  margin-bottom: 38px;
}

.skeleton-detail-title {
  width: min(620px, 64vw);
  height: clamp(34px, 6vw, 58px);
  border-radius: 18px;
}

.skeleton-detail-desc {
  width: min(760px, 100%);
  height: 18px;
  margin-bottom: 12px;
}

.skeleton-detail-desc.short {
  width: min(520px, 72%);
  margin-bottom: 28px;
}

.skeleton-detail-meta .skeleton-block {
  width: 132px;
  height: 38px;
  border-radius: 999px;
}

@keyframes skeleton-sweep {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-block::after,
  .repo-card {
    animation: none;
    transition: none;
  }
}

.repo-detail {
  max-width: 860px;
  padding-top: 0;
}

.detail-not-found-title {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.back-link {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--faint);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover { color: var(--accent); }

.detail-head {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 28px;
}

.detail-avatar {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.detail-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.detail-owner {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 14px;
}

.repo-detail h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .96;
  letter-spacing: -0.065em;
}

.detail-desc {
  max-width: 760px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 20px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-bottom: 24px;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.detail-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  line-height: 1;
}

.detail-meta span:first-child { color: var(--accent); }

.detail-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.detail-topics span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-link,
.copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.primary-link {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-link:hover,
.copy-link:hover {
  border-color: var(--accent);
}

.ai-summary,
.ai-block {
  max-width: 760px;
  margin-bottom: 28px;
}

.ai-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ai-summary p:not(.ai-kicker) {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.ai-audience {
  margin-top: 12px !important;
  color: var(--muted) !important;
  font-size: 15px !important;
}

.ai-block h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.ai-block ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.ai-block li {
  overflow-wrap: anywhere;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.brand,
.repo-card,
.repo-main,
.repo-name,
.repo-desc,
.card-footer,
.metric,
.repo-detail,
.detail-owner,
.detail-meta,
.detail-meta span,
.detail-topics,
.detail-topics span,
.primary-link,
.copy-link,
.back-link,
.section-title {
  min-width: 0;
}

.repo-detail h2,
.repo-name,
.repo-desc,
.detail-owner,
.detail-desc,
.detail-meta span,
.detail-topics span,
.primary-link,
.copy-link,
.back-link,
.section-title {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 1080px);
    padding-top: 16px;
  }

  .hero {
    margin-bottom: 14px;
  }

  .brand {
    font-size: 16px;
  }

  .brand::before {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .toolbar-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-controls {
    width: 100%;
  }

  .control-dropdown {
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .dropdown {
    flex: 1 1 auto;
    min-width: 0;
  }

  .dropdown-trigger {
    width: 100%;
    min-width: 0;
  }

  .repo-detail {
    max-width: none;
    padding-top: 0;
  }

  .back-link {
    margin-bottom: 24px;
  }

  .detail-head {
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
  }

  .detail-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    flex: 0 0 56px;
  }

  .detail-owner {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .repo-detail h2 {
    font-size: clamp(30px, 10vw, 44px);
    line-height: 1;
    letter-spacing: -0.055em;
  }

  .detail-desc {
    margin-bottom: 24px;
    font-size: 17px;
    line-height: 1.5;
  }

  .detail-meta {
    gap: 10px 16px;
    margin-bottom: 22px;
    font-size: 14px;
  }

  .detail-topics {
    gap: 8px 12px;
    margin-bottom: 28px;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .primary-link,
  .copy-link {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    text-align: center;
    white-space: normal;
  }

  .ai-summary,
  .ai-block {
    margin-bottom: 24px;
  }

  .ai-summary p:not(.ai-kicker) {
    font-size: 16px;
    line-height: 1.5;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 28px, 1240px);
  }

  .filter-group {
    width: 100%;
  }

  .filter-pill {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
  }

  .toolbar-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .control-dropdown {
    width: 100%;
    justify-content: space-between;
  }

  .dropdown-menu {
    left: 0;
    right: 0;
    min-width: 100%;
  }

}

@media (max-width: 420px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-bottom: 56px;
  }

  .detail-head {
    display: block;
  }

  .detail-avatar {
    margin-bottom: 16px;
  }

  .repo-detail h2 {
    font-size: clamp(28px, 11vw, 38px);
  }

  .detail-meta {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .page {
    width: min(100% - 16px, 1180px);
  }

  .brand {
    gap: 10px;
    font-size: 15px;
  }

  .brand::before {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .repo-card {
    padding: 16px;
    border-radius: 18px;
  }

  .avatar,
  .skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-basis: 40px;
  }

  .repo-detail h2 {
    font-size: clamp(26px, 10vw, 34px);
  }

  .detail-desc {
    font-size: 16px;
  }
}