/* ==========================================================================
   工具库 / TOOL ARCHIVE
   ========================================================================== */

:root {
  --bg: #06070a;
  --bg-2: #0a0d12;
  --panel: #0c1016;
  --ink: #e8f7ff;
  --muted: #8399a7;
  --dim: #4f626e;
  --cyan: #2ff3ff;
  --magenta: #ff2f7a;
  --lime: #d6ff4b;
  --line: rgba(47, 243, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --sans: ui-sans-serif, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono",
    "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --w: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: rgba(47, 243, 255, 0.85);
  color: #04121a;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--cyan);
  color: #04121a;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 背景层 ---------- */

.fx-grid,
.fx-glow,
.fx-scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.fx-grid {
  background-image: linear-gradient(rgba(47, 243, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 243, 255, 0.05) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: center top;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 78%);
}

.fx-glow {
  background:
    radial-gradient(52% 42% at 10% 0%, rgba(47, 243, 255, 0.1), transparent 70%),
    radial-gradient(42% 36% at 98% 25%, rgba(255, 47, 122, 0.07), transparent 72%),
    radial-gradient(60% 40% at 50% 100%, rgba(47, 243, 255, 0.04), transparent 70%);
}

.fx-scan {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.022) 0 1px,
    transparent 1px 4px
  );
  opacity: 0.6;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 460px) auto;
  align-items: center;
  gap: 24px;
  padding: 13px 24px;
  background: rgba(6, 7, 10, 0.82);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid rgba(47, 243, 255, 0.55);
  background: rgba(47, 243, 255, 0.07);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 68% 100%, 0 100%);
  box-shadow: inset 0 0 14px rgba(47, 243, 255, 0.16);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-sub {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px 0 12px;
  background: rgba(8, 11, 16, 0.9);
  border: 1px solid var(--line-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search:focus-within {
  border-color: rgba(47, 243, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(47, 243, 255, 0.15),
    0 0 26px -10px rgba(47, 243, 255, 0.5);
}

.search-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.search:focus-within .search-icon {
  stroke: var(--cyan);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.search input::placeholder {
  color: var(--dim);
}

.search input::-webkit-search-cancel-button {
  filter: invert(1);
  opacity: 0.35;
  cursor: pointer;
}

.search-kbd {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.topbar-link {
  justify-self: end;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.18s ease;
}

.topbar-link:hover {
  color: var(--cyan);
}

/* ---------- 主体 ---------- */

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding: 48px 24px 0;
}

.intro {
  padding-top: 8px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--cyan);
}

.intro h1 {
  margin-top: 18px;
  font-size: clamp(3.2rem, 8.6vw, 6.2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.94;
  background: linear-gradient(94deg, #f4feff 0%, #cdf4ff 46%, #6f9fae 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 62ch;
  margin-top: 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
  text-wrap: pretty;
}

.lede::first-letter {
  color: var(--ink);
}

/* ---------- 统计条 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 40px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.stats > div {
  padding: 2px 20px;
  border-left: 1px solid var(--line-soft);
}

.stats > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.stats dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
}

.stats dd {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--ink);
}

#statTotal {
  color: var(--cyan);
}

.stats > div:last-child dd {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 7px;
}

/* ---------- 筛选 ---------- */

.filters {
  margin-top: 42px;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 0;
}

.filter-label {
  flex: none;
  width: 44px;
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--dim);
}

.filter-label-gap {
  margin-left: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  transition: border-color 0.16s ease, color 0.16s ease,
    background-color 0.16s ease;
}

.chip:hover {
  border-color: rgba(47, 243, 255, 0.4);
  color: var(--ink);
}

.chip.is-active {
  border-color: rgba(47, 243, 255, 0.62);
  background: rgba(47, 243, 255, 0.09);
  color: var(--cyan);
}

.chip-n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  transition: color 0.16s ease;
}

.chip.is-active .chip-n {
  color: rgba(47, 243, 255, 0.8);
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-soft);
}

.result-count {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.sort {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  padding: 0 28px 0 10px;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238399a7' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.sort:hover {
  border-color: rgba(47, 243, 255, 0.4);
  color: var(--ink);
}

.sort option {
  background: #0b0f15;
  color: var(--ink);
}

.reset {
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  text-underline-offset: 4px;
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

.reset:hover {
  color: var(--magenta);
  text-decoration-color: var(--magenta);
}

/* ---------- 结果网格 ---------- */

.results {
  margin-top: 26px;
  min-height: 320px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(296px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 19px 15px;
  background: linear-gradient(
    165deg,
    rgba(15, 20, 27, 0.94) 0%,
    rgba(9, 12, 17, 0.94) 100%
  );
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.card[data-augmented-ui] {
  --aug-tl: 14px;
  --aug-br: 14px;
  --aug-border: 1px;
  --aug-border-bg: linear-gradient(
    135deg,
    rgba(47, 243, 255, 0.42) 0%,
    rgba(47, 243, 255, 0.08) 45%,
    rgba(255, 47, 122, 0.34) 100%
  );
}

.card[data-augmented-ui]:hover {
  --aug-border-bg: linear-gradient(
    135deg,
    rgba(47, 243, 255, 0.95) 0%,
    rgba(47, 243, 255, 0.35) 50%,
    rgba(255, 47, 122, 0.8) 100%
  );
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 46px -30px rgba(47, 243, 255, 0.65);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.card-index {
  color: rgba(47, 243, 255, 0.65);
}

.card-cat {
  white-space: nowrap;
}

.card[data-cat="SYS"] .card-cat {
  color: rgba(47, 243, 255, 0.62);
}

.card[data-cat="NET"] .card-cat {
  color: rgba(127, 178, 255, 0.66);
}

.card[data-cat="DEV"] .card-cat {
  color: rgba(214, 255, 75, 0.52);
}

.card[data-cat="MED"] .card-cat {
  color: rgba(255, 138, 76, 0.62);
}

.card[data-cat="SEC"] .card-cat {
  color: rgba(255, 47, 122, 0.66);
}

.card[data-cat="UTL"] .card-cat {
  color: rgba(185, 140, 255, 0.58);
}

.card-name {
  margin-top: 13px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.card-name a {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
  transition: color 0.16s ease;
}

.card-name a:hover {
  color: var(--cyan);
}

.card-arrow {
  font-size: 13px;
  font-weight: 400;
  color: var(--cyan);
  opacity: 0;
  transform: translate(-2px, 2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.card:hover .card-arrow,
.card-name a:focus-visible .card-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.card-vendor {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.card-desc {
  margin-top: 10px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-wrap: pretty;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.card-plats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.plat {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8ba0ad;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.badge {
  flex: none;
  padding: 3px 8px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  line-height: 1.4;
}

.badge--oss {
  color: rgba(198, 226, 132, 0.66);
  background: rgba(214, 255, 75, 0.045);
}

.badge--free {
  color: rgba(47, 243, 255, 0.9);
  background: rgba(47, 243, 255, 0.06);
}

.badge--comm {
  color: rgba(255, 47, 122, 0.9);
  background: rgba(255, 47, 122, 0.06);
}

/* ---------- 空状态 ---------- */

.empty {
  margin-top: 26px;
  padding: 76px 24px;
  border: 1px dashed rgba(47, 243, 255, 0.22);
  text-align: center;
}

.empty-code {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(47, 243, 255, 0.4);
}

.empty > p:not(.empty-code) {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13.5px;
}

.empty .reset {
  margin-top: 22px;
}

/* ---------- 页脚 ---------- */

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding: 26px 24px 44px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.footer a {
  transition: color 0.16s ease;
}

.footer a:hover {
  color: var(--cyan);
}

.footer-mid {
  color: rgba(79, 98, 110, 0.75);
}

.noscript {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--magenta);
  color: #180009;
  font-size: 12px;
  text-align: center;
}

/* ---------- 入场动画 ---------- */

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid.is-fresh .card {
  animation: card-in 0.46s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i) * 22ms);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
  }

  main {
    padding: 36px 20px 0;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats > div {
    padding: 10px 18px;
  }

  .stats > div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--line-soft);
  }

  .footer {
    padding: 24px 20px 36px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    padding: 10px 16px 12px;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 36px;
  }

  .topbar-link {
    font-size: 10px;
  }

  main {
    padding: 30px 16px 0;
  }

  .intro h1 {
    margin-top: 14px;
  }

  .lede {
    font-size: 14px;
  }

  .stats {
    margin-top: 30px;
  }

  .filters {
    margin-top: 32px;
  }

  .filter-row {
    padding: 6px 0;
    gap: 8px 10px;
  }

  .filter-label {
    width: 100%;
    padding-top: 0;
  }

  .filter-label-gap {
    margin-left: 0;
    margin-top: 6px;
  }

  .filter-bar {
    margin-top: 16px;
  }

  .result-count {
    width: 100%;
  }

  .filter-actions {
    width: 100%;
    justify-content: space-between;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 22px 16px 32px;
  }

  .footer-mid {
    display: none;
  }
}

@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .chip {
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .card {
    padding: 16px 16px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover {
    transform: none;
  }

  .grid.is-fresh .card {
    animation: none;
  }
}
