/* style.css */
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

* { box-sizing: border-box; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3143; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #39425a; }
::-webkit-scrollbar-track { background: transparent; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 0 90px;
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #e8edf7;
  background:
    radial-gradient(1100px 520px at 12% -8%, #1a2540 0%, transparent 62%),
    radial-gradient(900px 480px at 92% 2%, #2a1c3d 0%, transparent 58%),
    #0a0c11;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 头部 ---------- */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 24px 8px;
  text-align: center;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 46px);
  letter-spacing: .06em;
  font-weight: 800;
  background: linear-gradient(100deg, #7fd8ff, #a98bff 45%, #ff8ad0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px rgba(120, 140, 255, .25));
}

.sub {
  margin: 0 0 30px;
  color: #6f7a93;
  font-size: 12.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
}

/* ---------- 搜索框 ---------- */
.search {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  padding: 0 20px;
  transition: border-color .22s, box-shadow .22s, background .22s;
}
.search:focus-within {
  border-color: rgba(120, 170, 255, .55);
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 0 0 4px rgba(90, 140, 255, .12);
}
.search svg {
  width: 18px; height: 18px; flex: none;
  stroke: #6f7a93; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: #e8edf7;
  font-size: 15px;
  padding: 15px 12px;
  font-family: inherit;
}
.search input::placeholder { color: #626c84; }

/* ---------- 分类（大 Docker 包裹 + 滑动） ---------- */
/* ---------- 分类（大 Docker 包裹 + 滑动） ---------- */
.cats-wrap {
  max-width: 620px; /* 与搜索框宽度一致 */
  margin: 16px auto 0;
  padding: 0 24px; /* 与 hero 的内边距保持对齐 */
  display: flex;
  justify-content: center;
}

.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 16px rgba(0, 0, 0, 0.2);
  width: 100%; /* 撑满父容器，确保长度和搜索框对齐 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  scroll-behavior: smooth;
}
.cats::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.cat-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #b7c0d4;
  padding: 7px 17px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: .2s;
  white-space: nowrap;
}
.cat-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
.cat-btn.active {
  color: #0a0c11;
  font-weight: 600;
  background: linear-gradient(100deg, rgba(138, 217, 255, .95), rgba(183, 155, 255, .95));
  box-shadow: 0 4px 18px -4px rgba(140, 160, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .4);
}

/* ---------- 网格 ---------- */
.grid {
  max-width: 1180px;
  margin: 44px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  will-change: transform, opacity; /* 优化滑动切换性能 */
}

/* ---------- 访客信息卡片（七彩边框） ---------- */
.visitor-card {
  display: none;
  grid-column: 1 / -1;
  position: relative;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  isolation: isolate;
}
.visitor-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--ang),
      #ff5e5e, #ffbe5e, #5eff8e, #5ec9ff, #c25eff, #ff5e5e);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spin 6s linear infinite;
  pointer-events: none;
  opacity: 0.65;
  transition: opacity .25s;
  z-index: -1;
}
.visitor-card:hover::before { opacity: 1; }

.visitor-title {
  font-size: 12.5px;
  color: #8d97ad;
  letter-spacing: .16em;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.visitor-list { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.visitor-list > div { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.4; align-items: baseline; }
.visitor-list dt { color: #6f7a91; flex: none; min-width: 52px; }
.visitor-list dd { margin: 0; color: #cfd7e6; word-break: break-all; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .visitor-card { display: block; }
}

/* ---------- 卡片 ---------- */
.card {
  --h1: 210;
  --h2: 280;
  --delay: 0s;
  position: relative;
  border-radius: 16px;
  padding: 18px;
  background-color: #111520;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .012));
  cursor: pointer;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(18px) scale(.985);
  transition: opacity .55s cubic-bezier(.2, .8, .3, 1), transform .55s cubic-bezier(.2, .8, .3, 1), box-shadow .28s;
}
.card.in-view { opacity: 1; transform: none; }
.card.in-view:hover { transform: translateY(-4px); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .9), 0 0 30px -8px hsl(var(--h1) 95% 62% / .45); }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--ang), hsl(var(--h1) 95% 62%), hsl(var(--h2) 95% 62%), hsl(var(--h1) 95% 62%), hsl(var(--h2) 95% 62%), hsl(var(--h1) 95% 62%));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spin 6s linear infinite;
  animation-delay: var(--delay);
  pointer-events: none;
  opacity: .55;
  transition: opacity .25s;
  z-index: 2;
}
@keyframes spin { to { --ang: 360deg; } }
.card.in-view:hover::before { opacity: 1; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tag { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; color: hsl(var(--h1) 95% 74%); background: hsl(var(--h1) 95% 62% / .13); border: 1px solid hsl(var(--h1) 95% 62% / .32); }

/* ---------- 测速按钮 ---------- */
.speed {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px) saturate(140%); -webkit-backdrop-filter: blur(10px) saturate(140%);
  color: #a8b2c6; transition: .2s; white-space: nowrap; font-variant-numeric: tabular-nums;
  min-width: 64px; text-align: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.speed:hover { border-color: rgba(255, 255, 255, .32); color: #e8edf7; background: rgba(255, 255, 255, .1); }
.speed.testing { color: #9aa5bb; }
.speed.good { color: #4ee6a8; background: rgba(78, 230, 168, .12); border-color: rgba(78, 230, 168, .35); }
.speed.mid  { color: #ffd166; background: rgba(255, 209, 102, .12); border-color: rgba(255, 209, 102, .35); }
.speed.bad  { color: #ff7b8a; background: rgba(255, 123, 138, .12); border-color: rgba(255, 123, 138, .35); }

/* 测速动画 */
.speed-anim { position: relative; display: inline-flex; align-items: center; gap: 3px; height: 12px; vertical-align: middle; }
.speed-anim .pickaxe { font-size: 11px; line-height: 1; display: inline-block; transform-origin: 25% 85%; animation: pickSwing .45s cubic-bezier(.4, 0, .6, 1) infinite; }
@keyframes pickSwing { 0%, 100% { transform: rotate(-40deg); } 45%, 55% { transform: rotate(10deg); } }
.speed-anim .block { width: 9px; height: 9px; background: #8b96ad; border-radius: 2px; display: inline-block; animation: blockShake .45s infinite; }
@keyframes blockShake { 0%, 40%, 100% { transform: translateY(0); } 45% { transform: translateY(1.5px); } }
.speed-anim .spark { position: absolute; left: 12px; top: 1px; width: 2px; height: 2px; border-radius: 50%; background: #ffd166; opacity: 0; animation: sparkFly .45s infinite; }
.speed-anim .spark.s2 { animation-delay: .08s; left: 14px; top: 3px; background: #ff9f43; }
.speed-anim .spark.s3 { animation-delay: .16s; left: 11px; top: 4px; background: #ffd166; }
@keyframes sparkFly { 0%, 35% { opacity: 0; transform: translate(0, 0) scale(1); } 45% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -7px) scale(.3); } }

.name { margin: 0 0 8px; font-size: 17.5px; font-weight: 700; letter-spacing: .02em; line-height: 1.35; }
.desc { margin: 0 0 14px; color: #8d97ad; font-size: 13.5px; line-height: 1.65; flex: 1; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.meta span { font-size: 11.5px; color: #6f7a91; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); padding: 2.5px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font-size: 12.5px; padding: 7px 14px; border-radius: 9px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent;
  transition: .2s; font-family: inherit; white-space: nowrap; cursor: pointer;
  backdrop-filter: blur(10px) saturate(140%); -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 14px rgba(0, 0, 0, .2);
}
.btn.primary { color: hsl(var(--h1) 95% 78%); background: hsl(var(--h1) 95% 62% / .16); border-color: hsl(var(--h1) 95% 62% / .4); }
.btn.primary:hover { background: hsl(var(--h1) 95% 62% / .28); border-color: hsl(var(--h1) 95% 62% / .6); }
.btn.dl { color: #0a0c11; font-weight: 700; background: linear-gradient(100deg, hsl(var(--h1) 95% 68% / .92), hsl(var(--h2) 95% 68% / .92)); border-color: rgba(255, 255, 255, .25); }
.btn.dl:hover { filter: brightness(1.12); }
.btn.ghost { color: #b0b9cc; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); }
.btn.ghost:hover { color: #fff; border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); }
.btn.checking { opacity: .65; pointer-events: none; }

/* ---------- 空状态 ---------- */
.empty { display: none; text-align: center; color: #626c84; padding: 80px 20px; font-size: 14px; letter-spacing: .08em; }

/* ---------- 浏览进度 ---------- */
#progCircle {
  position: fixed; right: 22px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(17, 21, 32, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .09); display: grid; place-items: center; cursor: pointer; z-index: 99;
  user-select: none; transition: transform .2s, box-shadow .2s, opacity .3s; box-shadow: 0 8px 26px -10px rgba(0, 0, 0, .9);
}
#progCircle:hover { transform: scale(1.08); box-shadow: 0 10px 30px -8px rgba(120, 150, 255, .5); }
#progCircle svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#progCircle .track { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 3; }
#progCircle .bar { fill: none; stroke: url(#pg); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
#progCircle .pct { position: relative; font-size: 12px; font-weight: 700; color: #cfd7e6; font-variant-numeric: tabular-nums; letter-spacing: -.02em; transition: opacity .3s; }

#progBar { position: fixed; left: 0; right: 0; bottom: 0; height: 8px; padding-bottom: 4px; background: rgba(255, 255, 255, .05); cursor: pointer; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .3s; }
#progBar i { display: block; height: 4px; width: 0; background: linear-gradient(90deg, #4ad2ff, #a97bff, #ff7bd0); box-shadow: 0 0 12px rgba(120, 170, 255, .8); transition: width .12s linear; }
body.bar-mode #progCircle { opacity: 0; transform: scale(.7); pointer-events: none; }
body.bar-mode #progBar { opacity: 1; pointer-events: auto; }

#toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px);
  background: rgba(20, 24, 34, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #e8edf7; padding: 10px 18px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12);
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; z-index: 10000; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .hero { padding-top: 44px; }
  .grid { margin-top: 30px; padding: 0 16px; gap: 14px; }
  #progCircle { right: 16px; bottom: 16px; width: 50px; height: 50px; }
}