:root {
  --bg: #0f1729;
  --bg-2: #162033;
  --bg-3: #1d2842;
  --card: #162033;
  --card-2: #1d2842;
  --card-border: #2a3552;
  --accent: var(--brand-primary, #00d4ff);
  --accent-2: var(--brand-accent, #00e8a0);
  --accent-glow: rgba(0,212,255,0.18);
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --border: #2a3552;
  --border-light: #1e2a44;
  --red: #ef4444;
  --orange: #f59e0b;
  --green: #10b981;
  --blue: #3b82f6;
  --radius: 6px;
  --radius-sm: 4px;
  --font-sans: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --shadow: 0 4px 12px rgba(0,0,0,0.3);
  --max-w: 1440px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.55; min-height: 100vh; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.header { background: var(--bg-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.logo:hover { color: var(--accent); }
.logo::before { content: '◆'; color: var(--accent); margin-right: 4px; font-size: 14px; }
.logo-img { display: block; height: 28px; max-width: 180px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { padding: 7px 14px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; font-weight: 500; transition: all .15s ease; }
.nav a:hover { color: var(--text); background: var(--bg-3); }
.nav a.active { color: var(--accent); background: var(--accent-glow); }
.header-right { display: flex; gap: 12px; align-items: center; }
.lang-switch { display: flex; background: var(--bg-3); border-radius: var(--radius-sm); padding: 2px; }
.lang-btn { background: transparent; border: none; padding: 4px 10px; font-size: 11px; color: var(--text-2); font-weight: 600; font-family: var(--font-mono); border-radius: 3px; }
.lang-btn.active { background: var(--accent); color: var(--bg); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border); padding: 6px 8px; border-radius: var(--radius-sm); }
.nav-toggle-bar { display: block; width: 16px; height: 2px; background: var(--text); margin: 3px 0; }

main { min-height: 60vh; padding: 24px 0; }
.section { padding: 28px 0; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 24px; color: var(--text); letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 20px; background: var(--accent); border-radius: 2px; }

.hero { padding: 40px 0 28px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); margin: 16px 0 24px; box-shadow: var(--shadow); }
.hero .container { max-width: 1200px; }
.hero h1 { font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 12px; color: var(--text); }
.hero p { font-size: 15px; color: var(--text-2); margin-bottom: 24px; max-width: 780px; line-height: 1.55; }

.exchange-selector { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 12px; align-items: end; padding: 20px; background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 20px; }
.selector-group { display: flex; flex-direction: column; gap: 6px; }
.selector-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; font-family: var(--font-mono); }
.selector-select { padding: 9px 12px; border: 1px solid var(--border); background: var(--bg-3); font-family: inherit; font-size: 13px; color: var(--text); border-radius: var(--radius-sm); }
.selector-swap { background: var(--accent-glow); border: 1px solid var(--accent); width: 42px; height: 38px; color: var(--accent); font-size: 14px; font-weight: 700; border-radius: var(--radius-sm); }

.btn-primary { display: inline-block; padding: 9px 20px; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s ease; }
.btn-primary:hover { background: var(--accent-2); color: var(--bg); }
.btn-secondary { display: inline-block; padding: 8px 20px; background: var(--bg-3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-secondary:hover { background: var(--bg-2); border-color: var(--accent); }
.btn-go { display: inline-block; padding: 5px 12px; background: var(--accent); color: var(--bg) !important; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; text-decoration: none; }
.btn-go:hover { background: var(--accent-2); }

.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 24px; }
.stats-strip .stat-item:nth-child(3n) { display: block; }
.stat-item { padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); transition: all .2s ease; position: relative; overflow: hidden; }
.stat-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--text-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

.pairs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pair-card { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: 13px; transition: all .15s ease; }
.pair-card:hover { border-color: var(--accent); background: var(--bg-3); color: var(--text); }
.pair-codes { font-weight: 600; font-family: var(--font-mono); }
.pair-arrow { color: var(--text-3); font-size: 11px; }
.pair-count { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

.rate-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.rate-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rate-table thead th { background: var(--bg-3); padding: 10px 14px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.rate-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
.rate-table tbody tr:last-child td { border-bottom: none; }
.rate-table tbody tr:hover { background: var(--bg-3); }
.rate-value { font-family: var(--font-mono); font-weight: 600; color: var(--accent); }
.rate-best { color: var(--green); }

.exchanger-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exchanger-name a { color: var(--text); font-weight: 600; }
.exchanger-name a:hover { color: var(--accent); }
.trusted-badge, .licensed-badge { display: inline-block; padding: 2px 7px; font-size: 10px; font-weight: 600; border-radius: 3px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; }
.trusted-badge { background: rgba(16,185,129,0.15); color: var(--green); }
.licensed-badge { background: rgba(0,212,255,0.15); color: var(--accent); }

.exchanger-profile { padding: 24px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow); }
.exchanger-profile h1 { font-size: 24px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }

.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12px; font-weight: 500; margin-bottom: 20px; }
.back-link:hover { color: var(--accent); }

.faq-list { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 14px 20px; font-size: 14px; font-weight: 600; list-style: none; position: relative; padding-right: 36px; color: var(--text); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '⌄'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 14px; transition: transform .2s ease; }
.faq-item[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.faq-item[open] summary { background: var(--bg-3); }
.faq-answer { padding: 0 20px 16px; color: var(--text-2); font-size: 13px; line-height: 1.7; }

.exchanger-form { max-width: 640px; margin: 0 auto; padding: 28px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 12px; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.field-hint { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.field input, .field textarea { width: 100%; padding: 10px 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: 13px; color: var(--text); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.req { color: var(--red); }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.form-error, .form-success { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.form-error { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.form-success { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.honeypot { position: absolute; left: -9999px; }

.empty-state { padding: 48px; text-align: center; color: var(--text-3); font-size: 14px; background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); }

.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.article-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); transition: all .2s ease; }
.article-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.article-card-link { display: block; padding: 20px 22px; text-decoration: none; color: var(--text); }
.article-card-title { font-size: 16px; font-weight: 600; line-height: 1.35; margin-bottom: 10px; letter-spacing: -0.01em; }
.article-card-excerpt { color: var(--text-2); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.article-card-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.article-body { max-width: 760px; margin: 0 auto; padding: 32px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.article-head { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-head h1 { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 12px; }
.article-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); font-family: var(--font-mono); }
.article-content { font-size: 15px; line-height: 1.7; }
.article-content p { margin-bottom: 16px; }
.article-content h2 { font-size: 22px; font-weight: 700; margin: 28px 0 12px; letter-spacing: -0.01em; }
.article-content h3 { font-size: 18px; font-weight: 600; margin: 22px 0 10px; }
.article-content a { color: var(--accent); }
.article-content code { background: var(--bg-3); padding: 1px 6px; border-radius: 3px; color: var(--accent-2); font-family: var(--font-mono); font-size: 0.9em; }
.article-content blockquote { border-left: 2px solid var(--accent); padding: 8px 16px; margin: 18px 0; background: var(--bg-3); color: var(--text-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.pricing-card { max-width: 460px; margin: 0 auto; padding: 36px 32px; background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius); text-align: center; box-shadow: 0 8px 32px var(--accent-glow); position: relative; }
.pricing-badge { display: inline-block; padding: 3px 12px; background: var(--accent-glow); color: var(--accent); border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 16px; font-family: var(--font-mono); }
.pricing-price { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin-bottom: 4px; }
.pricing-amount { font-family: var(--font-mono); font-size: 52px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.pricing-currency { font-size: 16px; color: var(--text-2); font-weight: 600; }
.pricing-period { font-size: 12px; color: var(--text-2); margin-bottom: 24px; }
.pricing-features { text-align: left; margin: 24px 0; font-size: 13px; line-height: 1.7; }
.pricing-features li { padding: 4px 0 4px 22px; position: relative; color: var(--text-2); }
.pricing-features li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }
.subscribe-form { display: flex; flex-direction: column; gap: 12px; }
.subscribe-submit { padding: 12px; }
.subscribe-note { font-size: 11px; color: var(--text-3); text-align: center; }

.footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 40px 0 20px; margin-top: 56px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-title { font-size: 12px; font-weight: 600; margin-bottom: 12px; color: var(--text); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { font-size: 13px; color: var(--text-2); }
.footer-links a:hover { color: var(--accent); }
.footer-text { font-size: 12px; color: var(--text-2); line-height: 1.6; }

@media (max-width: 1024px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 8px 0; z-index: 100; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 24px; border-radius: 0; border-bottom: 1px solid var(--border-light); }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 24px; }
  .section-title { font-size: 18px; }
  .stats-strip { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .exchange-selector { grid-template-columns: 1fr; }
  .selector-swap { width: 100%; }
}


/* ==== shared from app.js dynamic rendering ==== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 8px;
}
.how-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
.how-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.how-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm, var(--radius));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
}
.how-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.how-card p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}
@media (max-width: 768px) {
  .how-grid { grid-template-columns: 1fr; gap: 14px; }
  .how-card { padding: 20px 18px; }
}


.exchanger-form .field-check { flex-direction: row; align-items: center; }
.exchanger-form .form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.exchanger-form .form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}
.exchanger-form .honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}
.exchanger-form .field-hint {
  display: block;
  margin-top: 4px;
}


.subscription-page .pricing-card { margin-top: 8px; }
.page-payment main { padding-top: 12px; }
.subscribe-error { padding: 10px 14px; border-radius: var(--radius-sm, var(--radius)); font-size: 14px; margin-top: 10px; color: var(--red, #c00); background: rgba(255,0,0,0.08); }


/* ===== stats-strip: ensure single row for 4 items ===== */
.stats-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  flex-wrap: nowrap !important;
}
.stats-strip .stat-item { min-width: 0; }
@media (max-width: 768px) {
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 480px) {
  .stats-strip { grid-template-columns: 1fr !important; }
}

/* ===== universal mobile safety ===== */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

@media (max-width: 768px) {
  .container { padding-left: 16px !important; padding-right: 16px !important; }
  .header-inner { padding-left: 16px !important; padding-right: 16px !important; }
  .footer-inner { padding-left: 16px !important; padding-right: 16px !important; }

  /* tables always scroll horizontally on mobile */
  .rate-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .rate-table { min-width: 480px; }

  /* prevent rogue overflow */
  img, video, iframe { max-width: 100%; height: auto; }
  pre, code { max-width: 100%; overflow-x: auto; }

  /* shadows must not leak past viewport edge */
  .hero, .exchanger-profile, .article-body, .exchanger-form, .pricing-card, .rate-table-wrap, .article-card, .stat-item {
    box-shadow: none !important;
  }
  .hero { margin-left: 0 !important; margin-right: 0 !important; }

  /* tame oversized headings */
  h1, .article-head h1, .exchanger-profile h1 { word-wrap: break-word; overflow-wrap: break-word; }
  .hero h1 { font-size: clamp(26px, 8vw, 44px) !important; line-height: 1.15 !important; }
  .section-title { font-size: clamp(20px, 6vw, 30px) !important; }
  .article-head h1 { font-size: clamp(24px, 7vw, 38px) !important; line-height: 1.2 !important; }
}

@media (max-width: 480px) {
  .container { padding-left: 12px !important; padding-right: 12px !important; }
  .header-inner { padding-left: 12px !important; padding-right: 12px !important; }
  .footer-inner { padding-left: 12px !important; padding-right: 12px !important; }
  .hero h1 { font-size: clamp(22px, 7vw, 32px) !important; }
}

/* ===== mobile grid collapse (v2) ===== */
@media (max-width: 768px) {
  .article-grid { grid-template-columns: 1fr !important; }
  .pairs-grid { grid-template-columns: 1fr !important; }
  .exchange-selector { grid-template-columns: 1fr !important; }
  .selector-swap { width: 100% !important; }

  /* anything with min-width on grid items should collapse */
  [class*="-grid"] > *, [class*="-list"] > * { min-width: 0; }
}

/* ===== mobile header order: logo | lang | burger ===== */
@media (max-width: 768px) {
  .header-inner > .logo { order: 1; }
  .header-inner > .header-right { order: 2; }
  .header-inner > .nav-toggle { order: 3; }
  .header-inner > .nav { order: 4; }
}

/* ===== exchanger badges: на новой строке после названия ===== */
.exchanger-name {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
  gap: 4px 6px;
}
.exchanger-name > a:first-child {
  flex-basis: 100%;
  min-width: 0;
}
.exchanger-name .trusted-badge,
.exchanger-name .licensed-badge {
  flex-shrink: 0;
}

.exchanger-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 10px;
}
.exchanger-profile h1 + .exchanger-badges { margin-top: 12px; }
