:root {
  --bg: #f5f7fb;
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --card-hover: #ffffff;
  --text: #1f2733;
  --text-muted: #6b7688;
  --text-faint: #9aa4b4;
  --border: #e4e8f0;
  --border-strong: #d4dae6;
  --accent: #4f6ef7;
  --accent-soft: #edf1ff;
  --accent-hover: #3d5ae6;
  --green: #16a34a;
  --shadow-sm: 0 1px 2px rgba(24, 39, 75, 0.04), 0 2px 8px rgba(24, 39, 75, 0.04);
  --shadow-md: 0 8px 24px rgba(24, 39, 75, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.orb-1 { width: 460px; height: 460px; background: #d9e2ff; top: -180px; right: -120px; }
.orb-2 { width: 380px; height: 380px; background: #e5ddff; top: 320px; left: -180px; }

.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 64px 20px 34px;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 10px rgba(79, 110, 247, 0.25));
}
h1 {
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.5px;
  font-weight: 800;
  background: linear-gradient(120deg, #1f2733 20%, #4f6ef7 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-muted); margin-top: 10px; font-size: 15px; }
.hero-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.badge {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.badge-source { color: var(--accent); }

.search-wrap {
  position: relative;
  margin-top: 28px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  opacity: 0.7;
}
#searchInput {
  width: 100%;
  padding: 15px 48px 15px 48px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
#searchInput::placeholder { color: var(--text-faint); }
#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}
.clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--bg-soft);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  display: none;
  font-size: 13px;
}
.clear-btn.show { display: block; }
.clear-btn:hover { background: var(--border-strong); color: var(--text); }

main { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 0 24px 60px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
}
.copy-all-btn {
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s;
  white-space: nowrap;
}
.copy-all-btn:hover { border-color: var(--accent); color: var(--accent); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tool-btn {
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s;
  white-space: nowrap;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent); }

.grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(90deg, var(--accent-soft), rgba(237, 241, 255, 0.25));
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background 0.18s;
}
.card-head:hover { background: var(--accent-soft); }
.card-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-arrow {
  font-size: 11px;
  color: var(--accent);
  width: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.card.is-collapsed .card-head { border-bottom-color: transparent; }
.card-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.card-title { font-size: 16px; font-weight: 700; }
.card-count { margin-left: auto; font-size: 12px; color: var(--text-faint); }

.card-body {
  padding: 12px 18px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.group-tip {
  width: 100%;
  flex-basis: 100%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  padding: 5px 10px;
  margin-top: 3px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}
.group-tip:first-child { margin-top: 0; }
.link-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s;
  flex: 0 1 auto;
  min-width: 210px;
  max-width: 100%;
  position: relative;
}
.link-row:hover { background: var(--accent-soft); border-color: #dbe3ff; }
.link-row.note-only { flex: 1 1 100%; }
.tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid;
}
.tag-github { background: #f1f3f5; color: #24292e; border-color: #d0d7de; }
.tag-ios     { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.tag-acc     { background: #eef2ff; color: #3730a3; border-color: #a5b4fc; }
.tag-web     { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.tag-warn    { background: #fffbeb; color: #92400e; border-color: #f0b040; }
.link-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}
.link-favicon {
  width: 22px; height: 22px; border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.link-info { display: flex; flex-direction: column; min-width: 0; }
.link-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-host {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* hover-only tooltip: hidden by default to keep boxes compact */
  position: absolute;
  left: 12px;
  top: calc(100% + 4px);
  background: #1f2733;
  color: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-sm);
  max-width: 320px;
}
.link-row:hover .link-host { opacity: 1; visibility: visible; }
.link-main:hover .link-name { color: var(--accent); }
.copy-btn {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.copy-btn.copied { background: var(--green); color: #fff; border-color: var(--green); }
.link-row.note-only { background: var(--bg-soft); align-items: flex-start; flex-wrap: wrap; }
.note-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }
.note-text > div + div { margin-top: 3px; }

mark { background: #fff3bf; color: inherit; border-radius: 3px; padding: 0 2px; }

/* ===== Image block (Catvod history) ===== */
.image-block {
  width: 100%;
  text-align: center;
  padding: 6px 0;
}
.image-block img.zoomable-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  margin: 0 auto;
}
.image-block img.zoomable-img:hover { transform: scale(1.01); box-shadow: var(--shadow-md); }
.image-caption { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 28, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
  cursor: zoom-out;
}
.lightbox.show { opacity: 1; visibility: visible; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty-emoji { font-size: 42px; margin-bottom: 10px; }
.empty-state p { font-size: 17px; font-weight: 600; color: var(--text); }
.empty-state span { font-size: 14px; }

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: 5px; }

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #1f2733;
  color: #fff;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .hero { padding: 44px 16px 26px; }
  main { padding: 0 14px 44px; }
  .card-head { padding: 11px 14px; }
  .card-body { padding: 10px 14px 14px; }
  .link-row { min-width: 160px; flex: 1 1 160px; }
  .group-tip { font-size: 12px; }
  #searchInput { padding: 13px 42px 13px 42px; font-size: 14px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .copy-all-btn { width: 100%; }
}
