:root {
    --bg: #0a0e17;
    --surface: #111827;
    --surface2: #1a2235;
    --text: #e5e7eb;
    --text-dim: #9ca3af;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --green: #10b981;
    --red: #ef4444;
    --border: #1f2937;
    --max-width: 760px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

/* ── Header ── */
header {
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(8px);
    z-index: 100;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

nav .logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.02em;
}

nav ul { list-style: none; display: flex; gap: 0.25rem; align-items: center; }
nav ul li a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
nav ul li a:hover { color: var(--text); background: var(--surface); }

.cta {
    background: var(--accent) !important;
    color: #000 !important;
    font-weight: 600 !important;
    padding: 0.4rem 0.9rem !important;
}
.cta:hover { background: var(--accent-hover) !important; }

/* ── Main ── */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* ── Article typography ── */
article h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: var(--text);
}

article h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

article h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin: 2rem 0 0.5rem;
}

article p {
    color: var(--text-dim);
    margin-bottom: 1rem;
}

article > p:first-of-type {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}

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

article strong { color: var(--text); font-weight: 600; }

/* ── Guide links (главная страница) ── */
article > p > a[href^="/guides/"],
article > p > a[href^="/"] {
    display: block;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 0.4rem;
    transition: border-color 0.15s, background 0.15s;
}

article > p > a[href^="/guides/"]:hover,
article > p > a[href^="/"]:hover {
    border-color: var(--accent);
    background: var(--surface2);
    text-decoration: none;
}

article > p > a[href^="/guides/"]::after,
article > p > a[href^="/"]:not([href="/"]):not([href^="/guides/bybit"])::after {
    content: " →";
    color: var(--accent);
    float: right;
}

/* ── Lists ── */
article ul, article ol {
    margin: 0.75rem 0 1rem 0;
    padding-left: 1.5rem;
    color: var(--text-dim);
}
article li { margin-bottom: 0.4rem; }
article li a { color: var(--accent); }

/* ── Code ── */
code {
    background: var(--surface);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.88em;
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

pre {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.25rem 0;
}
pre code { background: none; padding: 0; color: var(--text); }

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.92rem;
}

th {
    background: var(--surface);
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }
td a { color: var(--accent); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* ── Blockquote ── */
blockquote {
    border-left: 2px solid var(--border);
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.92rem;
}
blockquote p { margin: 0; color: var(--text-dim); }
blockquote a { color: var(--accent); }

/* ── HR ── */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.8;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    header { padding: 0 1rem; }
    nav { height: auto; padding: 0.75rem 0; flex-direction: column; gap: 0.75rem; }
    nav ul { flex-wrap: wrap; gap: 0.25rem; justify-content: center; }
    main { padding: 2rem 1rem 3rem; }
    article h1 { font-size: 1.6rem; }
    table { font-size: 0.85rem; }
    th, td { padding: 0.5rem 0.65rem; }
}
