* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light;
  --primary: #6366f1;
  --background: #f6f7fb;
  --header: rgba(255, 255, 255, .72);
  --card: rgba(255, 255, 255, .9);
  --text: #172033;
  --muted: #718096;
  --border: #e4e7ef;
  --shadow: rgba(30, 41, 59, .1);
}

html {
  scroll-behavior: smooth;
}

body.dark {
  color-scheme: dark;
  --background: #0f172a;
  --header: rgba(15, 23, 42, .8);
  --card: rgba(30, 41, 59, .92);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --shadow: rgba(0, 0, 0, .25);
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(99, 102, 241, .16), transparent 34%),
    radial-gradient(circle at 90% 18%, rgba(6, 182, 212, .12), transparent 30%),
    var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  transition: color .25s ease, background-color .25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 70px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--header);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-block;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899, #06b6d4, #6366f1);
  background-size: 250% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: 21px;
  font-weight: 850;
  letter-spacing: .5px;
  animation: gradientMove 7s linear infinite;
}

.theme-button {
  min-width: 62px;
  height: 40px;
  padding-inline: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: var(--card);
  transition: transform .2s ease, border-color .2s ease;
}

.theme-button:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, .65);
}

.hero {
  padding: 72px 0 42px;
  text-align: center;
}

.hero h1 {
  max-width: 900px;
  margin-inline: auto;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899, #0891b2, #4f46e5);
  background-size: 250% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 850;
  line-height: 1.18;
  letter-spacing: -2px;
  animation: gradientMove 8s linear infinite;
}

.search {
  width: min(680px, 100%);
  margin: 32px auto 0;
  padding: 8px;
  display: flex;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 16px 44px var(--shadow);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding-inline: 16px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
}

.search input::placeholder {
  color: var(--muted);
}

.search button {
  height: 48px;
  padding-inline: 25px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
  background-size: 200% 200%;
  font-weight: 750;
  transition: transform .2s ease, background-position .25s ease;
}

.search button:hover {
  transform: translateY(-1px);
  background-position: 100% 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  padding-bottom: 68px;
}

.card {
  min-width: 0;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--card);
  box-shadow: 0 7px 25px transparent;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, .55);
  box-shadow: 0 17px 36px var(--shadow);
}

.app-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card:hover .app-name {
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.arrow {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 21px;
  font-weight: 800;
  transition: transform .2s ease;
}

.card:hover .arrow {
  transform: translateX(4px);
}

.empty {
  padding: 50px 20px 80px;
  color: var(--muted);
  text-align: center;
}

.error-page {
  min-height: calc(100vh - 70px);
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
}

.error-code {
  color: var(--primary);
  font-size: clamp(72px, 18vw, 150px);
  font-weight: 900;
  line-height: .9;
}

.error-page p {
  color: var(--muted);
}

.home-link {
  width: fit-content;
  margin-inline: auto;
  padding: 12px 20px;
  border-radius: 12px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(99, 102, 241, .35);
  outline-offset: 3px;
}

@keyframes gradientMove {
  from { background-position: 0% center; }
  to { background-position: 250% center; }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .container { width: min(100% - 22px, 1160px); }
  .hero { padding: 50px 0 34px; }
  .hero h1 { letter-spacing: -1px; }
  .search button { padding-inline: 18px; }
  .grid { grid-template-columns: 1fr; }
}

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