:root {
  --bg: #020617;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #334155;
  --border: #1e293b;
  --border-light: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --violet: #8b5cf6;
  --violet-dark: #7c3aed;
  --cyan: #06b6d4;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --teal: #14b8a6;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--violet); text-decoration: none; transition: color 0.15s; }
a:hover { color: #a78bfa; }

code, pre { font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* === Header === */
header.help-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: white; }
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}
.logo-icon svg { width: 18px; height: 18px; color: white; }
.logo-text { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.logo-text span { color: var(--violet); }
.btn-back {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-back:hover { background: var(--surface-2); border-color: var(--violet); color: white; }
.btn-back svg { width: 14px; height: 14px; }

/* === Hero (index page) === */
.hero { padding: 4.5rem 0 2.5rem; text-align: center; position: relative; }
.hero::before {
  content: ''; position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  pointer-events: none; z-index: -1;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.05;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 30%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem; }

.search-box { max-width: 500px; margin: 0 auto; position: relative; }
.search-box input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 2.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.2s;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box input:focus { outline: none; border-color: var(--violet); background: var(--surface-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.search-box svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-dim); }

/* === Categories === */
.categories { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 2.5rem 0 3rem; }
.category-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.category-pill:hover { background: var(--surface-2); color: var(--text); }
.category-pill.active { background: var(--violet); border-color: var(--violet); color: white; }

/* === Article grid === */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding-bottom: 4rem;
}
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.article-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  opacity: 0; transition: opacity 0.2s;
}
.article-card:hover { transform: translateY(-3px); border-color: var(--violet); background: var(--surface-2); }
.article-card:hover::before { opacity: 1; }
.article-card .icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.article-card .icon svg { width: 22px; height: 22px; }
.icon-violet { background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.2); color: var(--violet); }
.icon-cyan { background: rgba(6, 182, 212, 0.12); border: 1px solid rgba(6, 182, 212, 0.2); color: var(--cyan); }
.icon-emerald { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--emerald); }
.icon-amber { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--amber); }
.icon-rose { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.2); color: var(--rose); }
.icon-teal { background: rgba(20, 184, 166, 0.12); border: 1px solid rgba(20, 184, 166, 0.2); color: var(--teal); }
.article-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.3; }
.article-card p { font-size: 0.88rem; color: var(--text-muted); flex-grow: 1; line-height: 1.55; }
.article-card .meta {
  display: flex; gap: 1rem; margin-top: 1.25rem;
  font-size: 0.7rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.article-card .meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.article-card .meta svg { width: 11px; height: 11px; }

.no-results { text-align: center; padding: 4rem 1rem; color: var(--text-muted); display: none; }
.no-results .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* === Article page === */
.article-header { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); }
.breadcrumb { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 1.25rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--violet); }
.breadcrumb svg { width: 12px; height: 12px; opacity: 0.5; }
.article-header h1 {
  font-size: clamp(1.85rem, 3.8vw, 2.65rem);
  font-weight: 800;
  margin-bottom: 0.85rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.article-header .lede { font-size: 1.05rem; color: var(--text-muted); max-width: 720px; line-height: 1.6; }
.article-header .meta-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1.25rem; font-size: 0.8rem; color: var(--text-dim); }
.article-header .meta-row span { display: inline-flex; align-items: center; gap: 0.4rem; }
.article-header .meta-row svg { width: 13px; height: 13px; opacity: 0.7; }

.article-body { padding: 2.5rem 0 3rem; }
.article-body h2 {
  font-size: 1.4rem; font-weight: 700;
  margin: 2.5rem 0 1rem; color: white;
  letter-spacing: -0.01em;
  scroll-margin-top: 90px;
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-size: 1.1rem; font-weight: 700;
  margin: 1.75rem 0 0.75rem; color: white;
  scroll-margin-top: 90px;
}
.article-body p { margin-bottom: 1.1rem; color: var(--text-muted); line-height: 1.7; }
.article-body ul, .article-body ol { margin: 0 0 1.25rem 1.5rem; color: var(--text-muted); }
.article-body li { margin-bottom: 0.5rem; line-height: 1.6; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body code {
  background: var(--surface-2);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-size: 0.86em;
  color: var(--cyan);
  border: 1px solid var(--border);
}
.article-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 1rem 0 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.article-body pre code { background: transparent; padding: 0; color: var(--text); border: none; }
.article-body a { color: var(--violet); text-decoration: underline; text-decoration-color: rgba(139, 92, 246, 0.3); text-underline-offset: 3px; }
.article-body a:hover { text-decoration-color: var(--violet); }

.callout {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  font-size: 0.92rem;
}
.callout-icon { flex-shrink: 0; width: 22px; height: 22px; margin-top: 0.1rem; }
.callout p { margin: 0; color: var(--text); line-height: 1.55; }
.callout p + p { margin-top: 0.6rem; }
.callout-info { background: rgba(6, 182, 212, 0.08); border: 1px solid rgba(6, 182, 212, 0.25); }
.callout-info .callout-icon { color: var(--cyan); }
.callout-warn { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); }
.callout-warn .callout-icon { color: var(--amber); }
.callout-success { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.25); }
.callout-success .callout-icon { color: var(--emerald); }

/* Article layout with TOC */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 3rem; align-items: start; }
@media (max-width: 900px) { .article-layout { grid-template-columns: 1fr; gap: 0; } }

.toc {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 1.1rem 1.1rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.85rem;
}
.toc h4 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.75rem; font-weight: 700; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.15rem 0; }
.toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all 0.15s;
  font-size: 0.82rem;
  line-height: 1.4;
}
.toc a:hover { color: var(--violet); border-left-color: var(--violet); background: rgba(139, 92, 246, 0.06); }
@media (max-width: 900px) { .toc { display: none; } }

/* FAQ accordion */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color 0.15s;
}
.faq-item:hover { border-color: var(--border-light); }
.faq-item.open { border-color: var(--violet); }
.faq-question {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  user-select: none;
  color: var(--text);
  font-size: 0.95rem;
}
.faq-question::after {
  content: '';
  width: 18px; height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item.open .faq-question::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}
.faq-answer {
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s, padding 0.3s;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.faq-item.open .faq-answer { padding: 0 1.25rem 1.25rem; max-height: 800px; }
.faq-answer p { margin-bottom: 0.85rem; }
.faq-answer p:last-child { margin-bottom: 0; }

/* Glossary */
.glossary-term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.7rem;
  transition: border-color 0.15s;
}
.glossary-term:hover { border-color: var(--border-light); }
.glossary-term h3 {
  font-size: 0.95rem;
  margin: 0 0 0.45rem;
  color: var(--violet);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.glossary-term p { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

.glossary-letter {
  font-size: 2rem;
  font-weight: 800;
  color: var(--violet);
  margin: 2.5rem 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}
.glossary-letter:first-child { margin-top: 0; }

/* Related articles */
.related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.related h3 { font-size: 1.1rem; margin-bottom: 1rem; color: white; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.related-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 0.5rem;
}
.related-link:hover { border-color: var(--violet); background: var(--surface-2); color: white; }
.related-link svg { width: 14px; height: 14px; color: var(--text-dim); flex-shrink: 0; }

/* Footer */
footer.help-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: var(--bg);
}
footer.help-footer .container { display: flex; flex-direction: column; gap: 1rem; align-items: center; }
footer.help-footer .links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
footer.help-footer a { color: var(--text-muted); text-decoration: none; }
footer.help-footer a:hover { color: var(--violet); }
footer.help-footer .brand { font-weight: 600; color: var(--text-muted); }

/* Responsive */
@media (max-width: 600px) {
  .hero { padding: 3rem 0 1.5rem; }
  .article-header { padding: 2rem 0 1.5rem; }
  .article-body { padding: 1.5rem 0 2rem; }
  .article-grid { grid-template-columns: 1fr; }
}
