:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-2: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f3f6fb;
  --line: #e4e8f0;
  --ink: #1d2330;
  --muted: #5a6473;
  --faint: #98a1b0;
  --brand: #4f7cff;
  --brand-2: #7c5cff;
  --hot: #f4516c;
  --new: #15b88a;
  --radius: 16px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { overflow-x: hidden; margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(79, 124, 255, 0.1), transparent 60%),
    radial-gradient(820px 520px at 100% 0%, rgba(124, 92, 255, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 16px rgba(91, 140, 255, 0.4);
}
.brand-mark.small { width: 24px; height: 24px; font-size: 11px; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-size: 14px;
  white-space: nowrap;
}
.nav-actions a { color: var(--muted); transition: color 0.15s; }
.nav-actions a:hover { color: var(--ink); }
.nav-primary {
  padding: 9px 16px;
  border-radius: 999px;
  color: #fff !important;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

/* —— Layout containers —— */
main {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

/* —— Hero —— */
.hero { padding: 56px 0 28px; text-align: center; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #1d2330, #4f6bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead {
  max-width: 620px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
}
/* —— Feature spot —— */
.feature-spot { margin: 12px 0 40px; }
.feature-spot-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: center;
  padding: 32px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(124, 92, 255, 0.18), transparent 60%),
    linear-gradient(120deg, var(--panel), var(--panel-2));
  overflow: hidden;
}
.feature-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--new);
  background: rgba(45, 212, 167, 0.12);
  border: 1px solid rgba(45, 212, 167, 0.3);
  border-radius: 999px;
}
.feature-copy h2 { margin: 0 0 10px; font-size: 26px; }
.feature-copy p { margin: 0 0 20px; color: var(--muted); line-height: 1.6; max-width: 420px; }
.feature-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.button {
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.button:active { transform: translateY(1px); }
.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.35);
}
.button.primary:hover { box-shadow: 0 10px 30px rgba(91, 140, 255, 0.5); }
.button.ghost {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--line);
}
.button.ghost:hover { background: rgba(15, 23, 42, 0.06); }

/* —— Downloads —— */
.downloads-hero { padding-bottom: 20px; }
.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 42px;
}
.download-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.download-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 124, 255, 0.55);
  box-shadow: 0 16px 36px rgba(40, 60, 120, 0.12);
}
.download-banner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 104px;
  padding: 18px;
  background:
    radial-gradient(260px 120px at 20% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(91, 140, 255, 0.85), rgba(124, 92, 255, 0.85));
}
.download-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 32px rgba(91, 140, 255, 0.35);
}
.download-meta {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(11, 13, 18, 0.28);
}
.download-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}
.download-body h2 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.35;
}
.download-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.download-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}
.download-tags span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.03);
  font-size: 12px;
}
.download-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.download-code { font-size: 13px; color: var(--muted); }
.download-code b {
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 2px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(79, 124, 255, 0.1);
}
.downloads-cta {
  margin: 0 0 72px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(45, 212, 167, 0.14), transparent 60%),
    linear-gradient(120deg, var(--panel), var(--panel-2));
}
.downloads-cta p { color: var(--muted); line-height: 1.7; max-width: 680px; }

/* —— Home: 首屏精选资源小卡 —— */
.mini-downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 40px;
}
.mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.mini-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(40, 60, 120, 0.1);
}
.mini-cat {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(91, 140, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}
.mini-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-dl {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--faint);
  transition: color 0.15s;
}
.mini-card:hover .mini-dl { color: var(--brand); }

/* —— Home: 精选资源区块 —— */
.home-downloads { margin: 6px 0 56px; }
.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.see-all {
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s;
}
.see-all:hover { color: var(--ink); }
.home-downloads .downloads-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 16px 0 0;
}
.resource-logo {
  color: var(--brand);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.home-resource-card .tool-desc {
  -webkit-line-clamp: 1;
}
.resource-list-card .tool-desc {
  -webkit-line-clamp: 1;
}
.resource-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}
.resource-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.resource-action.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.resource-action:hover {
  border-color: var(--brand);
  color: var(--ink);
}
.resource-action.primary:hover {
  color: #fff;
}
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  padding: 10px 16px;
  border: 1px solid rgba(79, 124, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(40, 60, 120, 0.14);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(14px);
  transition: opacity 0.18s, transform 0.18s;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.copy-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(29, 35, 48, 0.42);
}
.copy-sheet[hidden] {
  display: none;
}
.copy-sheet-panel {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(40, 60, 120, 0.18);
}
.copy-sheet-panel h2 {
  margin: 0 0 6px;
  font-size: 17px;
}
.copy-sheet-panel p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.copy-sheet-panel textarea {
  width: 100%;
  min-height: 142px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
}
.copy-sheet-panel .resource-action {
  width: 100%;
}

/* —— Resource detail —— */
.resource-detail-page {
  width: min(980px, calc(100% - 32px));
}
.resource-detail-hero {
  padding-bottom: 18px;
}
.resource-detail-card {
  margin: 0 auto 72px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(40, 60, 120, 0.1);
}
.resource-detail-card.is-empty {
  text-align: center;
}
.resource-detail-card.is-empty h2 {
  margin: 0 0 10px;
}
.resource-detail-card.is-empty p {
  margin: 0 0 20px;
  color: var(--muted);
}
.resource-back {
  display: inline-flex;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.resource-back:hover {
  color: var(--brand);
}
.resource-detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.resource-detail-head .tool-logo {
  width: 48px;
  height: 48px;
  font-size: 15px;
  flex-shrink: 0;
}
.resource-detail-head h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.2;
}
.resource-detail-desc {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.65;
}
.resource-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  margin: 0 0 14px;
}
.resource-info-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.resource-info-block label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.resource-link-value {
  display: block;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.resource-code-value {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-size: 18px;
  letter-spacing: 0.08em;
}
.resource-share-text {
  width: 100%;
  min-height: 132px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.65;
}
.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-actions .button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.detail-actions .button.ghost {
  border: 1px solid var(--line);
}

.feature-preview {
  padding: 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(40, 60, 120, 0.08);
  font-size: 13px;
}
.preview-topbar { display: flex; gap: 7px; margin-bottom: 14px; }
.preview-topbar span { width: 10px; height: 10px; border-radius: 50%; background: #d6dbe5; }
.preview-line { padding: 9px 12px; margin-bottom: 8px; border-radius: 10px; background: rgba(15, 23, 42, 0.04); color: var(--muted); }
.preview-line.assistant { background: rgba(79, 124, 255, 0.1); color: var(--ink); }
.preview-line b { color: var(--ink); }
.preview-pill {
  margin-top: 12px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--brand);
  background: rgba(91, 140, 255, 0.1);
}

/* —— Layout: sidebar + tools —— */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  padding-bottom: 60px;
}

.cat-nav {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.cat-link:hover { background: var(--panel); color: var(--ink); }
.cat-link.is-active {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}
.cat-ico { font-size: 16px; line-height: 1; }
.cat-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--faint);
  background: rgba(15, 23, 42, 0.04);
  padding: 1px 8px;
  border-radius: 999px;
}

.cat-filters { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cat-filters-title { margin: 0 0 10px; font-size: 12px; color: var(--faint); padding-left: 4px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--ink); }
.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
}

/* —— Tool sections —— */
.tool-section { margin-bottom: 38px; }
.section-head { margin-bottom: 16px; }
.section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 20px;
}
.section-head p { margin: 0; font-size: 14px; color: var(--faint); }

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

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: 0 14px 30px rgba(40, 60, 120, 0.12);
}
.tool-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tool-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.tool-logo img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.tool-logo.is-fallback {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
}
.tool-logo.is-fallback::after {
  content: attr(data-fallback);
}
.tool-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.tool-region { font-size: 12px; color: var(--faint); }
.tool-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 9px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 6px;
}
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  color: #fff;
}
.badge.hot { background: var(--hot); }
.badge.new { background: var(--new); color: #fff; }

.empty-state { text-align: center; color: var(--faint); padding: 60px 0; }

/* —— Footer —— */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  padding: 28px clamp(16px, 4vw, 40px);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner > div { display: flex; align-items: center; gap: 10px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--ink); }
.footer-note {
  max-width: 1200px;
  margin: 14px auto 0;
  font-size: 12px;
  color: var(--faint);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .feature-spot-inner { grid-template-columns: 1fr; }
  .feature-preview { display: none; }
  .downloads-grid { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .cat-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
  }
  /* 让 #cat-list 的按钮直接参与父级横向 flex，而不是堆成一个高盒子 */
  .cat-nav #cat-list { display: contents; }
  .cat-link {
    width: auto;
    padding: 8px 14px;
    background: var(--panel);
    border-color: var(--line);
  }
  .cat-count { display: none; }
  .cat-filters {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-top: none;
    padding-top: 0;
    margin-top: 4px;
  }
  .cat-filters-title { margin: 0; }
}

@media (max-width: 640px) {
  .site-header { gap: 10px; padding: 12px 16px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  /* 头部只保留主按钮，次要链接在主推位和页脚里已有 */
  .nav-actions a:not(.nav-primary) { display: none; }
  .nav-actions { gap: 10px; }
  .nav-primary { padding: 8px 14px; font-size: 13px; }
  .hero { padding: 36px 0 20px; }
  .hero h1 { font-size: 30px; }
  .feature-spot-inner { padding: 22px; }
  .download-banner { min-height: 88px; }
  .download-body { padding: 18px; }
  .downloads-cta { padding: 22px; }
  .resource-detail-card { padding: 18px; }
  .resource-detail-head { gap: 12px; }
  .resource-info-grid { grid-template-columns: 1fr; }
  .detail-actions { flex-direction: column; }
  .detail-actions .button { justify-content: center; width: 100%; }
}
