:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --text: #0e1726;
  --text-dim: #5b6573;
  --accent: #0b8aff;
  --accent-hover: #086fd1;
  --border: #e3e8ef;
  --shadow: 0 1px 3px rgba(13, 27, 62, 0.06);
  --shadow-hover: 0 6px 18px rgba(13, 27, 62, 0.08);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  user-select: none;
  cursor: pointer;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  background: transparent;
}
.topnav { display: inline-flex; gap: 16px; align-items: center; }
.topnav a { font-size: 14px; color: var(--text-dim); }
.topnav a:hover { color: var(--accent); }
.topnav a.cta {
  background: var(--accent);
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.topnav a.cta:hover { background: var(--accent-hover); color: white; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  padding: 56px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-dim);
  margin: 0 0 28px;
  font-size: 17px;
}
.search-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}
#search {
  width: 100%;
  padding: 14px 18px 14px 46px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 138, 255, 0.15);
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* ── Categories grid ────────────────────────────────────────────────── */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 8px 0 40px;
}
.category-card {
  display: block;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #cdd6e0;
}
.category-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(11, 138, 255, 0.2);
}
.category-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
  line-height: 1;
}
.category-title {
  font-size: 16px;
  font-weight: 600;
  display: block;
  color: var(--text);
}
.category-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

/* ── Content area (subcategories / leaves) ──────────────────────────── */
.content {
  margin-bottom: 60px;
}
.content:empty { margin-bottom: 0; }
.section-title {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 18px;
  letter-spacing: -0.01em;
}
.breadcrumb {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.breadcrumb button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.breadcrumb button:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qa-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.qa-item:hover { border-color: #cdd6e0; }
.qa-item.open { box-shadow: var(--shadow-hover); border-color: #c3d3e3; }
.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  gap: 12px;
  background: none;
  border: none;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
}
.qa-title { font-size: 16px; font-weight: 500; }
.qa-chevron {
  flex-shrink: 0;
  transition: transform 0.18s, color 0.18s;
  color: var(--text-dim);
  display: block;
}
/* Subcategory: point the chevron right (it navigates, doesn't expand). */
.qa-chevron.is-nav { transform: rotate(-90deg); }
/* Open leaf: rotate the down-chevron 180° so it points up. */
.qa-item.open .qa-chevron { transform: rotate(180deg); color: var(--accent); }
.qa-body {
  padding: 0 20px 18px;
  color: #1f2a3a;
  font-size: 15.5px;
  line-height: 1.6;
}
.qa-body b { color: var(--text); }
.qa-body i { color: #2c3a52; }
.qa-body a {
  color: var(--accent);
  /* No underline: on the support-bot handle the underline under the "@"
     rendered as a broken dot next to it (client 2026-07-19). The accent
     colour already marks the link, and the whole «@ElegantWalletSupportBot»
     stays one clickable anchor — tapping the "@" still opens the bot. */
  text-decoration: none;
}
.qa-body a:hover { color: var(--accent-hover); }
/* «Важно»-callout: bot answers wrap important notes in <blockquote>
   (Telegram renders them as a quote block, here — a blue info box). */
.qa-body blockquote {
  /* Bottom margin gives a clear blank-line gap after a quote box so the next
     topic heading isn't glued to it (client 2026-07-19 «выглядит налеплено»).
     app.js strips the answer's \n around <blockquote>, so this margin is the
     only vertical separation between the box and the following text. */
  margin: 14px 0 20px;
  padding: 12px 16px;
  background: rgba(11, 138, 255, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
}

/* Nested subcategory link inside a leaf */
.qa-item.subcategory .qa-header { background: var(--surface-2); }

/* Hard hide that beats display:grid/flex on the parent (the HTML5
   ``hidden`` attribute is overridden by any explicit ``display`` rule). */
.is-hidden { display: none !important; }

/* ── Search results ─────────────────────────────────────────────────── */
.search-results {
  margin: 0 0 48px;
}
.search-results h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
mark {
  background: rgba(11, 138, 255, 0.18);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

/* ── Footer CTA ─────────────────────────────────────────────────────── */
.footer-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 40px;
}
.footer-cta h2 {
  font-size: 22px;
  margin: 0 0 8px;
  font-weight: 600;
}
.footer-cta p {
  color: var(--text-dim);
  margin: 0 0 18px;
}
.cta-button {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s;
}
.cta-button:hover { background: var(--accent-hover); color: white; }

.sitefoot {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}
.sitefoot .sep { margin: 0 10px; opacity: 0.5; }

@media (max-width: 600px) {
  .topnav a:not(.cta) { display: none; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 28px; }
  .subtitle { font-size: 15px; }
  .categories { gap: 12px; }
  .category-card { padding: 18px 16px; }
  .section-title { font-size: 20px; }
}
