:root {
  color-scheme: light;
  --page: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --text: #14171f;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #5c5ff5;
  --brand-soft: #f0efff;
  --shadow: 0 16px 40px rgba(36, 45, 66, 0.06);
  --card-shadow: 0 14px 32px rgba(36, 45, 66, 0.045);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111318;
  --surface: #181b22;
  --surface-muted: #20242d;
  --text: #f4f6fa;
  --muted: #a5adbd;
  --line: #303541;
  --brand: #8587ff;
  --brand-soft: #292a52;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  --card-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100dvh;
  margin: 0;
  padding: 10px;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

.page-shell {
  min-height: calc(100dvh - 20px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  font-weight: 720;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(92, 95, 245, 0.24);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button,
.search-trigger,
.search-close {
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.icon-button:hover,
.search-trigger:hover,
.search-close:hover {
  background: var(--surface-muted);
}

.icon-button svg,
.search-trigger svg,
.search-close svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.theme-icon-dark {
  display: none;
}

:root[data-theme="dark"] .theme-icon-light {
  display: none;
}

:root[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.search-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 15px;
}

main {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: clamp(66px, 8vh, 94px) 38px 92px;
}

.intro {
  text-align: center;
}

.intro h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.24;
  font-weight: 760;
}

.intro > p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.search-wrap {
  width: min(100%, 520px);
  height: 50px;
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.search-wrap[hidden] {
  display: none;
}

.search-wrap > svg {
  width: 19px;
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-wrap input::placeholder {
  color: #8a93a3;
}

.search-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
  margin-top: clamp(62px, 8vh, 82px);
}

.tool-card {
  min-height: 452px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 54px 30px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.tool-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--line) 58%, var(--text));
  box-shadow: 0 22px 48px rgba(36, 45, 66, 0.1);
}

.tool-card[hidden] {
  display: none;
}

.tool-icon {
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  border-radius: 34px;
}

.tool-icon svg {
  width: 56px;
  height: 56px;
  stroke-width: 1.7;
}

.tool-icon-poster {
  color: #6964ee;
  background: #f0efff;
}

.tool-icon-database {
  color: #1dab69;
  background: #eaf9f1;
}

.tool-icon-xhs {
  color: #ffffff;
  background: #fff0f3;
}

.tool-icon-xhs span {
  min-width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 15px;
  background: #ff3657;
  box-shadow: 0 10px 24px rgba(255, 54, 87, 0.24);
  font-size: 19px;
  font-weight: 760;
  white-space: nowrap;
}

.tool-icon-video {
  color: #2877ee;
  background: #edf4ff;
}

.tool-card h2 {
  margin: 28px 0 0;
  font-size: 24px;
  line-height: 1.35;
}

.tool-card p {
  min-height: 54px;
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
  line-height: 1.8;
}

.tool-link {
  min-width: 148px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  border: 1px solid currentColor;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
  transition: color 180ms ease, background 180ms ease, transform 120ms ease;
}

.tool-link svg {
  width: 17px;
  height: 17px;
  transition: transform 180ms ease;
}

.tool-link:hover svg {
  transform: translateX(3px);
}

.tool-link:active {
  transform: translateY(1px) scale(0.98);
}

.tool-link-poster {
  color: #615cf0;
}

.tool-link-database {
  color: #169a5d;
}

.tool-link-xhs {
  color: #f52f52;
}

.tool-link-video {
  color: #216fe4;
}

.tool-link-poster:hover {
  color: #ffffff;
  background: #615cf0;
}

.tool-link-database:hover {
  color: #ffffff;
  background: #169a5d;
}

.tool-link-xhs:hover {
  color: #ffffff;
  background: #f52f52;
}

.tool-link-video:hover {
  color: #ffffff;
  background: #216fe4;
}

.empty-state {
  margin: 84px auto 0;
  text-align: center;
  color: var(--muted);
}

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

.empty-state svg {
  width: 38px;
  height: 38px;
}

.empty-state h2 {
  margin: 18px 0 6px;
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  margin: 0;
}

footer {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.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;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 48%, transparent);
  outline-offset: 3px;
}

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

@media (max-width: 640px) {
  body {
    padding: 0;
  }

  .page-shell {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    min-height: 68px;
    padding: 0 18px;
  }

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

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .search-trigger span {
    display: none;
  }

  .search-trigger {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  main {
    padding: 52px 18px 66px;
  }

  .intro h1 {
    font-size: 29px;
  }

  .intro > p {
    max-width: 280px;
    margin: 14px auto 0;
    font-size: 15px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 46px;
  }

  .tool-card {
    min-height: 360px;
    padding: 38px 24px 30px;
  }

  .tool-icon {
    width: 100px;
    height: 100px;
    border-radius: 28px;
  }

  .tool-icon svg {
    width: 46px;
    height: 46px;
  }

  .tool-card h2 {
    margin-top: 22px;
  }

  footer {
    flex-wrap: wrap;
  }
}

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