:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #14141d;
  --bg-card-hover: #1a1a26;
  --border: #1e1e2e;
  --border-hover: #2e2e45;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-icon { font-size: 1.4rem; }

.logo-text {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--border);
}

.header-search {
  position: relative;
}

.header-search input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px 8px 40px;
  color: var(--text-primary);
  font-size: 0.875rem;
  width: 220px;
  outline: none;
  transition: all 0.2s;
}

.header-search input:focus {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  width: 260px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Hero ── */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.12), transparent);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Ad Slots ── */
.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  padding: 12px 0;
}

.ad-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 728px;
  max-width: 100%;
  height: 90px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.ad-placeholder::after {
  content: 'AD SLOT — 728 × 90';
}

.ad-banner { padding: 8px 0; }

.ad-incontent-wrap {
  padding: 32px 0;
}

.ad-placeholder-sm {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 60px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ad-placeholder-sm::after {
  content: 'AD SLOT';
}

/* ── Category Tabs ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 32px 0 24px;
}

.cat-tab {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cat-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.cat-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Tool Cards Grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s;
  position: relative;
}

.tool-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px var(--border-hover);
}

.tool-card.hidden { display: none; }

.card-link {
  display: block;
  padding: 20px;
  height: 100%;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-logo-placeholder {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.tool-info { flex: 1; min-width: 0; }

.tool-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(99,102,241,0.12);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.2);
}

.tool-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.no-results {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 0 40px;
  color: var(--text-secondary);
}

.page-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all 0.2s;
}

.page-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Post Detail ── */
.post-hero {
  padding: 48px 0 32px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color 0.2s;
}

.back-link:hover { color: var(--text-primary); }

.post-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.post-excerpt {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
  max-width: 680px;
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  padding-bottom: 60px;
  align-items: start;
}

.post-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  min-width: 0;
}

.post-content h1, .post-content h2, .post-content h3 {
  margin: 1.5em 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.post-content p { margin-bottom: 1em; color: var(--text-secondary); line-height: 1.8; }

.post-content a { color: var(--accent); }
.post-content a:hover { text-decoration: underline; }

.post-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 1em 0; }

.post-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 1em 0;
}

.post-content code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  background: rgba(99,102,241,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content pre code { background: none; padding: 0; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 1em 0;
  font-style: italic;
}

.post-sidebar { position: sticky; top: 80px; }

.visit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 20px;
  transition: background 0.2s;
}

.visit-btn:hover { background: var(--accent-hover); }

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.sidebar-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.sidebar-ad { min-height: 250px; }

/* ── Category Page ── */
.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.page-desc { color: var(--text-secondary); }

/* ── Article Page ── */
.article-layout {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 0 80px;
}

.article-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
}

.article-content h1, .article-content h2, .article-content h3 {
  margin: 1.5em 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.article-content p { margin-bottom: 1em; color: var(--text-secondary); line-height: 1.8; }
.article-content a { color: var(--accent); }
.article-content a:hover { text-decoration: underline; }
.article-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 1em 0; }
.article-content ul, .article-content ol { padding-left: 1.5em; margin-bottom: 1em; color: var(--text-secondary); }
.article-content li { margin-bottom: 0.4em; }
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 1em 0;
}
.article-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 1em 0;
}
.article-content code {
  font-family: 'Fira Code', monospace;
  font-size: 0.875em;
  background: rgba(99,102,241,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.article-content pre code { background: none; padding: 0; }

.post-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text-secondary); }

/* ── Error Page ── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
}

.error-code {
  font-size: 6rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Main Layout ── */
.main-content { padding-bottom: 40px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-sidebar { position: static; }
}

@media (max-width: 768px) {
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .header-search input { width: 160px; }
  .header-search input:focus { width: 200px; }
  .hero { padding: 40px 0 28px; }
  .ad-placeholder { width: 100%; height: 60px; }
  .ad-placeholder::after { content: 'AD SLOT'; }
  .post-content { padding: 24px; }
  .article-content { padding: 24px; }
}

@media (max-width: 480px) {
  .nav-links { display: none; }
  .tools-grid { grid-template-columns: 1fr; }
  .header-search input { width: 140px; }
}
