:root {
  --bg: #111214;
  --surface: #18191c;
  --border: #2a2d32;
  --text: #d4d7dc;
  --muted: #767c87;
  --link: #6ea8fe;
  --link-hover: #9ec5fe;
  --accent: #4dabf7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", "Fira Code", Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 24px 32px;
  max-width: 1440px;
  margin: 0 auto;
}

/* 顶部栏：标题 + 极简过滤搜索框 */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

header h1 span {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: 8px;
}

.search-box {
  position: relative;
  width: 280px;
  max-width: 100%;
}

.search-box input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
}

/* 改用 CSS 多列瀑布流：短卡片自动紧凑排布，消除底部留白 */
.grid {
  column-count: 3;
  column-gap: 24px;
}

@media (max-width: 1024px) {
  .grid {
    column-count: 2;
  }
}

@media (max-width: 640px) {
  .grid {
    column-count: 1;
  }
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 24px;
  break-inside: avoid; /* 防止单个卡片在换列时被从中间劈开 */
}

.category.hidden {
  display: none;
}

.category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.sub-group {
  margin-top: 10px;
}

.sub-group:first-of-type {
  margin-top: 0;
}

.sub-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

ul {
  list-style: none;
}

li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

li.hidden {
  display: none;
}

li a {
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

li a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

li .desc {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* 占位链接（尚未配置地址）：灰显、不可点击 */
li.placeholder .link-like {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: not-allowed;
}

/* 加载失败 / 无匹配结果提示 */
.load-error,
.empty-msg {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  padding: 16px 0;
}

.load-error {
  color: #e67e80;
}

@media (max-width: 600px) {
  body {
    padding: 16px;
  }
}
