:root {
  --bg: #f5f7fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f5f7fb;
  --card-bg: #ffffff;
  --card-border: #e6e9f0;
  --text: #1a1f36;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 8px 16px rgba(79, 70, 229, 0.12), 0 20px 40px rgba(16, 24, 40, 0.12);
}

html[data-theme="dark"] {
  --bg: #0d1117;
  --bg-grad-1: #131a2a;
  --bg-grad-2: #0d1117;
  --card-bg: #161b22;
  --card-border: #262c36;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --accent: #7c8cff;
  --accent-soft: #1c2333;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 16px rgba(124, 140, 255, 0.15), 0 20px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  transition: background 0.3s ease, color 0.3s ease;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
}
.theme-toggle:hover { transform: scale(1.08); box-shadow: var(--shadow-hover); }

.hero {
  text-align: center;
  padding: 72px 20px 24px;
  max-width: 720px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--accent), #9333ea);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  font-size: clamp(15px, 2.5vw, 18px);
  color: var(--text-muted);
  margin: 0 0 28px;
}

.search-wrap { max-width: 480px; margin: 0 auto; }
#search {
  width: 100%;
  padding: 13px 18px;
  font-size: 15px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.category-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 28px 6px 14px;
}

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

.card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.card::after {
  content: "↗";
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 16px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.card:hover::after { opacity: 1; transform: translate(2px, -2px); }

.card-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--accent-soft);
  overflow: hidden;
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }

.card-body { min-width: 0; }
.card-name {
  font-size: 16px;
  font-weight: 700;
  margin: 2px 0 4px;
  padding-right: 18px;
}
.card-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 8px;
}
.card-url {
  font-size: 12px;
  color: var(--accent);
  word-break: break-all;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  padding: 40px 20px;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 20px 40px;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .hero { padding-top: 56px; }
  .grid { grid-template-columns: 1fr; }
}
