/* ===== 设计变量 ===== */
:root {
  --bg: #f5f7fb;
  --bg-glow-1: rgba(59, 110, 246, 0.13);
  --bg-glow-2: rgba(124, 92, 255, 0.11);
  --grid-line: rgba(23, 32, 51, 0.028);
  --panel: #ffffff;
  --panel-soft: #fafbfe;
  --text: #111420;
  --text-soft: #39404f;
  --muted: #78808f;
  --line: #e8ebf3;
  --line-strong: #d9dee9;
  --brand: #3b6ef6;
  --brand-2: #7c5cff;
  --brand-soft: #eef2ff;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05), 0 4px 10px -6px rgba(17, 24, 39, .10);
  --shadow-md: 0 2px 4px rgba(17, 24, 39, .04), 0 14px 30px -16px rgba(17, 24, 39, .25);
  --shadow-lg: 0 6px 12px rgba(17, 24, 39, .06), 0 28px 50px -24px rgba(17, 24, 39, .32);
  --radius: 15px;
  --topbar-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f16;
    --bg-glow-1: rgba(78, 120, 255, 0.18);
    --bg-glow-2: rgba(130, 96, 255, 0.14);
    --grid-line: rgba(255, 255, 255, 0.022);
    --panel: #151a24;
    --panel-soft: #121721;
    --text: #eef1f7;
    --text-soft: #c4ccda;
    --muted: #8b95a7;
    --line: #232b38;
    --line-strong: #303a4a;
    --brand: #7aa0ff;
    --brand-2: #a78bfa;
    --brand-soft: #1b2438;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 14px -8px rgba(0, 0, 0, .5);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 34px -18px rgba(0, 0, 0, .7);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, .35), 0 32px 60px -28px rgba(0, 0, 0, .8);
  }
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 28px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景光晕 + 细网格 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(780px 380px at 8% -6%, var(--bg-glow-1), transparent 68%),
    radial-gradient(680px 340px at 92% -10%, var(--bg-glow-2), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 62%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }

.wrap {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

.muted { color: var(--muted); }
.link { color: var(--brand); font-weight: 550; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--bg); }
}

.topbar.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 20px -18px rgba(17, 24, 39, .5);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 100%;
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 16px -8px rgba(59, 110, 246, .95);
  position: relative;
  flex: none;
  overflow: hidden;
}

/* 风形标记 */
.brand-mark::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 17px;
  height: 8px;
  transform: translateY(-50%);
  border-top: 2px solid rgba(255, 255, 255, .95);
  border-bottom: 2px solid rgba(255, 255, 255, .95);
  border-radius: 3px;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .45), transparent 55%);
}

.brand-mark.sm {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  box-shadow: none;
}

.brand-mark.sm::before {
  left: 4px;
  width: 12px;
  height: 6px;
  border-width: 1.5px;
  border-radius: 2px;
}

.search {
  position: relative;
  flex: 1;
  max-width: 500px;
  margin-left: 6px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
  transition: color .16s;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 48px 0 40px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.search input::placeholder { color: var(--muted); }

.search input:focus {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), var(--shadow-sm);
}

.search:focus-within .search-icon { color: var(--brand); }

.search input::-webkit-search-cancel-button { cursor: pointer; }

.search-kbd {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: inherit;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 7px;
  background: var(--panel-soft);
  pointer-events: none;
  transition: opacity .15s;
}

.search input:focus ~ .search-kbd { opacity: 0; }

.topbar-actions { margin-left: auto; display: flex; gap: 10px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--brand), #4f7cf8);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 14px -10px rgba(59, 110, 246, .9);
  transition: transform .14s, box-shadow .18s, border-color .16s, color .16s, background .16s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -12px rgba(59, 110, 246, .95); }
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: var(--panel);
  color: var(--text-soft);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
  background: var(--panel);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* ===== Hero ===== */
.hero { padding: 56px 0 30px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px 0 9px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
  font-size: 12px;
  font-weight: 550;
  color: var(--text-soft);
  margin-bottom: 16px;
  letter-spacing: .01em;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.16;
  letter-spacing: -.035em;
  font-weight: 800;
  background: linear-gradient(112deg, var(--text) 26%, var(--brand) 88%, var(--brand-2) 118%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  width: fit-content;
}

.hero-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 56ch;
}

.hero-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
}

.stat-chip strong {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.stat-chip em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
}

/* ===== 搜索结果条 ===== */
.result-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-xs);
  font-size: 14px;
}

.result-bar .link { margin-left: auto; }

/* ===== 布局 ===== */
.layout {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-bottom: 44px;
}

.sidebar { position: sticky; top: calc(var(--topbar-h) + 22px); }

.sidebar-label {
  margin: 0 0 10px;
  padding-left: 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat-nav { display: flex; flex-direction: column; gap: 2px; }

.cat-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 14px;
  transition: background .16s, color .16s, transform .16s, box-shadow .16s;
}

.cat-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  transition: height .18s;
}

.cat-nav-item:hover {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transform: translateX(2px);
}

.cat-nav-item.active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.cat-nav-item.active::before { height: 16px; }

.cat-nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: .92; }
.cat-nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-nav-count {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 7px;
  line-height: 17px;
  font-variant-numeric: tabular-nums;
}

/* ===== 分组 ===== */
.group {
  margin-bottom: 36px;
  scroll-margin-top: calc(var(--topbar-h) + 22px);
  animation: fadeUp .3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .group { animation: none; }
  html { scroll-behavior: auto; }
}

.group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}

.group-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.012em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-icon { font-size: 15px; }

.group-count {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 8px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

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

/* ===== 卡片 ===== */
.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform .18s cubic-bezier(.2,.6,.3,1), box-shadow .18s, border-color .18s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  box-shadow: var(--shadow-md);
}

.card:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.card-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .04);
  transition: transform .18s, box-shadow .18s;
}

.card:hover .card-icon { transform: scale(1.05); }

.card-icon img { width: 24px; height: 24px; object-fit: contain; }

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.card-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-host {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  opacity: .75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .16s, opacity .16s;
}

.card:hover .card-host { color: var(--brand); opacity: 1; }

.pin {
  position: absolute;
  top: -8px;
  right: 11px;
  font-size: 10.5px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 6px 12px -6px rgba(59, 110, 246, .95);
}

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 58px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.empty-page { margin: 8px 0 64px; }
.empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
.empty-hint { margin: 0; color: var(--muted); font-size: 14px; }

/* ===== 页脚 ===== */
.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  margin-top: 16px;
  background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.footer-brand { display: flex; align-items: center; gap: 9px; }

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.footer-links a:hover { color: var(--brand); }
.footer-sep { width: 1px; height: 11px; background: var(--line-strong); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .layout > * { min-width: 0; }
  .sidebar { position: static; }
  .sidebar-inner { overflow-x: auto; scrollbar-width: none; }
  .sidebar-inner::-webkit-scrollbar { display: none; }
  .sidebar-label { display: none; }
  .cat-nav { flex-direction: row; gap: 8px; padding-bottom: 8px; }
  .cat-nav-item {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 20px;
    padding: 5px 13px;
    white-space: nowrap;
  }
  .cat-nav-item::before { display: none; }
  .cat-nav-item:hover { transform: none; }
  .hero { padding: 38px 0 22px; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .topbar-inner { gap: 12px; }
  .search { margin-left: 0; }
  .grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero-stats { gap: 8px; }
}

@media (max-width: 560px) {
  .brand-text { display: none; }
  .hero h1 { font-size: 28px; }
  .stat-chip { padding: 6px 11px; }
  .topbar-actions .btn { padding: 0 12px; font-size: 13px; }
}

/* ===== 卡片复制按钮 ===== */
.card-body { padding-right: 16px; }

.card-copy {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-3px) scale(.94);
  transition: opacity .16s, transform .16s, color .16s, border-color .16s, background .16s;
}

.card-copy svg { width: 13px; height: 13px; }

.card:hover .card-copy,
.card-copy:focus-visible { opacity: 1; transform: none; }

.card-copy:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.card-copy.copied {
  color: #047857;
  border-color: #6ee7b7;
  background: #ecfdf5;
  opacity: 1;
}

/* ===== 回到顶部 ===== */
.to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 40;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-soft);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform .18s, color .16s, border-color .16s, opacity .2s;
}

.to-top[hidden] { display: none; }
.to-top svg { width: 17px; height: 17px; }
.to-top:hover { transform: translateY(-2px); color: var(--brand); border-color: var(--brand); }

/* ===== 轻提示 ===== */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 84vw;
  padding: 10px 16px;
  border-radius: 11px;
  background: #161a22;
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  animation: toastIn .22s cubic-bezier(.2,.7,.3,1);
}

.toast.leaving { animation: toastOut .2s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(.97); }
}

@media (prefers-color-scheme: dark) {
  .toast { background: #f2f5fa; color: #111420; }
}

@media (max-width: 560px) {
  .to-top { right: 16px; bottom: 16px; width: 38px; height: 38px; }
  .toast-stack { bottom: 22px; }
}
