:root {
  --bg: #f4f6f8;
  --panel: rgba(255, 255, 255, 0.9);
  --text: #172033;
  --muted: #64748b;
  --line: rgba(113, 128, 150, 0.24);
  --button: #102033;
  --button-text: #ffffff;
  --soft: #edf4f7;
  --shadow: 0 18px 36px rgba(51, 65, 85, 0.1);
  --focus: #1f7ae0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, #f5f7fb 0%, #eef7f3 52%, #fff7ef 100%);
}

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

button,
input {
  font: inherit;
}

.topbar,
main,
.footer-note {
  width: min(1440px, calc(100% - 36px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 26px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #ffffff;
  background: #0f172a;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 320px;
}

.page-tabs,
.category-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.page-tab,
.category-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.page-tab {
  min-width: 86px;
  padding: 0 14px;
  font-weight: 800;
}

.page-tab.is-active,
.category-tab.is-active {
  color: #ffffff;
  background: #102033;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(320px, 100%);
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.search-box span {
  color: var(--muted);
  font-size: 18px;
}

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

.category-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  overflow-x: auto;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.category-tab {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 0 14px;
  font-weight: 700;
}

.catalog-view {
  display: grid;
  gap: 34px;
}

.group-section {
  min-width: 0;
}

.group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.group-head h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
}

.group-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: right;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 194px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.tool-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}

.tool-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tool-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-size: 16px;
  font-weight: 900;
}

.tool-name {
  min-width: 0;
}

.tool-name strong,
.tool-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-name strong {
  font-size: 17px;
  line-height: 1.25;
}

.tool-name span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.start-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--button-text);
  background: var(--button);
  font-size: 12px;
  font-weight: 900;
}

.start-button:hover,
.start-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.abilities li {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  color: #475569;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.25;
}

.summary {
  display: -webkit-box;
  overflow: hidden;
  margin: auto 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.empty-state {
  margin: 30px 0;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.68);
}

.footer-note {
  margin-top: 20px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.footer-note span {
  color: var(--text);
  font-weight: 800;
}

@media (min-width: 1480px) {
  .tool-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

  .group-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .group-head p {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .topbar,
  main,
  .footer-note {
    width: min(100% - 20px, 1560px);
  }

  .brand h1 {
    font-size: 23px;
  }

  .page-tabs,
  .category-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

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

@media (max-width: 420px) {
  .tool-card-head {
    align-items: stretch;
    flex-direction: column;
  }
}
