:root {
  color-scheme: dark;
  --bg: #080b12;
  --bg-elevated: rgba(17, 23, 35, 0.82);
  --panel: rgba(15, 21, 32, 0.72);
  --panel-strong: rgba(21, 28, 42, 0.94);
  --line: rgba(159, 178, 214, 0.15);
  --line-strong: rgba(159, 178, 214, 0.25);
  --text: #f4f7ff;
  --muted: #98a5bc;
  --muted-strong: #c1c9d8;
  --accent: #7c8cff;
  --accent-2: #67e8f9;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 12px;
  --content-width: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

::selection {
  background: rgba(124, 140, 255, 0.34);
  color: #fff;
}

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

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(7, 10, 17, 0.24), rgba(7, 10, 17, 0.9)),
    url("background-grid.png") center top / cover no-repeat,
    #080b12;
}

.ambient::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(8, 11, 18, 0.94) 0%, rgba(8, 11, 18, 0.2) 52%, rgba(8, 11, 18, 0.82) 100%),
    linear-gradient(180deg, transparent 0%, rgba(8, 11, 18, 0.1) 35%, var(--bg) 100%);
}

.site-shell {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 26px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid rgba(124, 140, 255, 0.34);
  border-radius: 13px;
  background:
    linear-gradient(145deg, rgba(124, 140, 255, 0.2), rgba(103, 232, 249, 0.06)),
    rgba(18, 24, 38, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 35px rgba(62, 77, 162, 0.18);
  color: #bcc5ff;
}

.brand__mark svg {
  width: 21px;
  height: 21px;
}

.brand__copy {
  display: grid;
  gap: 2px;
}

.brand__copy strong {
  font-size: 0.88rem;
  letter-spacing: 0.11em;
}

.brand__copy small {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.search {
  position: relative;
  display: flex;
  width: min(440px, 100%);
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 16px;
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}

.search__icon svg {
  width: 18px;
  height: 18px;
}

.search__input {
  width: 100%;
  height: 48px;
  padding: 0 88px 0 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  background: rgba(14, 19, 30, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search__input::placeholder {
  color: #748198;
}

.search__input:focus {
  border-color: rgba(124, 140, 255, 0.72);
  background: rgba(18, 24, 38, 0.94);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.13);
}

.search__shortcut {
  position: absolute;
  right: 13px;
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
}

.search__clear {
  position: absolute;
  right: 47px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 48px;
  align-items: end;
  min-height: 330px;
  padding: 88px 0 50px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--accent-2);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.eyebrow > span:first-child {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-2), transparent);
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(3.15rem, 7vw, 6.65rem);
  font-weight: 740;
  letter-spacing: -0.065em;
  line-height: 0.93;
  word-break: keep-all;
  text-wrap: balance;
  text-shadow: 0 15px 55px rgba(0, 0, 0, 0.35);
}

.hero__description {
  max-width: 590px;
  margin: 27px 0 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.85;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-card {
  display: grid;
  min-height: 158px;
  align-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(14, 20, 31, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

.meta-card--accent {
  border-color: rgba(124, 140, 255, 0.26);
  background:
    linear-gradient(145deg, rgba(124, 140, 255, 0.15), rgba(14, 20, 31, 0.76)),
    rgba(14, 20, 31, 0.72);
}

.meta-card__label {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.meta-card strong {
  margin-top: 15px;
  font-size: 2.45rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
  line-height: 1;
}

.meta-card > span:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.77rem;
}

.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(13, 18, 29, 0.74);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-tab {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.category-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.category-tab[aria-selected="true"] {
  border-color: rgba(124, 140, 255, 0.32);
  background: rgba(124, 140, 255, 0.15);
  color: #edf0ff;
}

.category-tab__count {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font-size: 0.67rem;
  font-variant-numeric: tabular-nums;
}

.result-summary {
  min-width: max-content;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.content {
  display: grid;
  gap: 38px;
  min-height: 340px;
  padding: 36px 0 20px;
}

.group {
  display: grid;
  gap: 17px;
}

.group__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

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

.group__index {
  color: var(--accent-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.group h2 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: -0.025em;
}

.group__description {
  margin: 0;
  color: var(--muted);
  font-size: 0.81rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.app-card {
  position: relative;
  display: grid;
  min-height: 232px;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 45%),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.app-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--card-color, var(--accent));
  opacity: 0.82;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--card-color, var(--accent)) 38%, var(--line-strong));
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--card-color, var(--accent)) 10%, transparent), transparent 52%),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.app-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.app-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-color, var(--accent)) 32%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--card-color, var(--accent)) 13%, transparent);
  color: var(--card-color, var(--accent));
}

.app-card__icon svg {
  width: 21px;
  height: 21px;
}

.favorite-button[aria-pressed="true"] {
  color: var(--warning);
}

.favorite-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.app-card__body {
  align-self: end;
  padding: 28px 0 20px;
}

.app-card h3 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.app-card__description {
  min-height: 48px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.tag {
  padding: 5px 8px;
  border: 1px solid rgba(159, 178, 214, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #9da9bd;
  font-size: 0.67rem;
}

.app-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 15px;
  border-top: 1px solid rgba(159, 178, 214, 0.1);
}

.app-card__host {
  overflow: hidden;
  color: #728097;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-link {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--card-color, var(--accent)) 30%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card-color, var(--accent)) 11%, transparent);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.launch-link:hover {
  border-color: color-mix(in srgb, var(--card-color, var(--accent)) 58%, transparent);
  background: color-mix(in srgb, var(--card-color, var(--accent)) 18%, transparent);
}

.launch-link:active {
  transform: scale(0.98);
}

.launch-link svg {
  width: 15px;
  height: 15px;
}

.empty-state {
  display: grid;
  min-height: 290px;
  place-items: center;
  padding: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 18px;
  background: rgba(124, 140, 255, 0.12);
  color: var(--accent);
}

.empty-state__icon svg {
  width: 25px;
  height: 25px;
}

.empty-state h2 {
  margin: 0;
  font-size: 1.25rem;
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--muted);
}

.loading-state {
  display: flex;
  min-height: 290px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.loading-state__spinner {
  width: 21px;
  height: 21px;
  border: 2px solid rgba(124, 140, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.error-state {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(251, 113, 133, 0.25);
  border-radius: var(--radius-md);
  background: rgba(251, 113, 133, 0.08);
}

.error-state[hidden] {
  display: none;
}

.error-state__icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: rgba(251, 113, 133, 0.13);
  color: var(--danger);
}

.error-state__icon svg {
  width: 21px;
  height: 21px;
}

.error-state h2 {
  margin: 0;
  font-size: 1rem;
}

.error-state p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.button--secondary {
  margin-left: auto;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.button svg {
  width: 16px;
  height: 16px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 42px;
  padding: 20px 2px 0;
  border-top: 1px solid rgba(159, 178, 214, 0.1);
  color: #69768c;
  font-size: 0.72rem;
}

.footer p {
  margin: 0;
}

.footer__signal {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
}

.footer kbd,
.noscript {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-strong);
  font-family: inherit;
}

.footer kbd {
  display: inline-grid;
  min-width: 23px;
  height: 22px;
  padding: 0 5px;
  place-items: center;
  font-size: 0.65rem;
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 380px;
  padding: 14px 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

:focus-visible {
  outline: 3px solid rgba(103, 232, 249, 0.72);
  outline-offset: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 70px;
  }

  .hero__meta {
    max-width: 560px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(calc(100% - 28px), var(--content-width));
    padding-top: 18px;
  }

  .topbar {
    display: grid;
    gap: 18px;
  }

  .search {
    width: 100%;
  }

  .hero {
    min-height: auto;
    padding: 65px 0 36px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2.85rem, 14vw, 5.25rem);
    white-space: nowrap;
  }

  .control-panel {
    display: grid;
  }

  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .category-tabs::-webkit-scrollbar {
    display: none;
  }

  .category-tab {
    flex: 0 0 auto;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .group__header {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .error-state {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .error-state .button {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 430px) {
  .hero__meta {
    grid-template-columns: 1fr 1fr;
  }

  .meta-card {
    min-height: 134px;
    padding: 16px;
  }

  .meta-card strong {
    font-size: 2rem;
  }

  .search__shortcut {
    display: none;
  }

  .search__input {
    padding-right: 52px;
  }

  .search__clear {
    right: 8px;
  }

  .app-card {
    min-height: 224px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
