:root {
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-dim: #6e7681;
    --bg: #1c1f26;
    --card-bg: rgba(255,255,255,0.04);
    --card-border: rgba(255,255,255,0.08);
    --card-hover: rgba(255,255,255,0.08);
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --red: #e04040;
    --red-light: #f06050;
    --red-faint: rgba(224, 64, 64, 0.08);
    --code-bg: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.06);
}

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

html { background: #141619; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px 64px;
    line-height: 1.6;
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(60, 65, 80, 0.5) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 30% 20%, rgba(200, 60, 50, 0.06) 0%, transparent 50%),
        linear-gradient(180deg, #2a2d35 0%, #1c1f26 30%, #141619 100%);
    -webkit-font-smoothing: antialiased;
}

/* ---- Top bar ---- */

.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0 16px;
    margin-bottom: 8px;
    font-size: 14px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.topbar-brand:hover { color: var(--red-light); }

.topbar-brand img {
    border-radius: 6px;
}

.topbar-divider {
    color: var(--text-dim);
    font-weight: 300;
}

.topbar-section {
    color: var(--text-muted);
}

/* ---- Breadcrumb ---- */

.breadcrumb {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 24px;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent);
}

/* ---- Hero (index) ---- */

.hero {
    text-align: center;
    padding: 32px 0 40px;
}

.hero h1 {
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.hero-sub {
    font-size: 1.1em;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* ---- Topic grid (index) ---- */

.topics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 520px) {
    .topics-grid { grid-template-columns: 1fr; }
}

.topic-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
}

.topic-card:hover {
    border-color: var(--red);
    background: var(--card-hover);
    text-decoration: none;
}

.topic-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    padding-top: 2px;
}

.topic-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topic-text strong {
    font-size: 14px;
    font-weight: 600;
}

.topic-text span {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---- Article pages ---- */

.article h1 {
    font-size: 1.75em;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.article .subtitle {
    font-size: 1.05em;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 32px;
}

.article h2 {
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 36px;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.article h3 {
    font-size: 1em;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 6px;
}

.article p {
    margin-bottom: 14px;
    line-height: 1.7;
}

.article ul, .article ol {
    margin-bottom: 14px;
    padding-left: 22px;
}

.article li {
    margin-bottom: 6px;
    line-height: 1.6;
}

/* ---- Links ---- */

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

/* ---- Code ---- */

code {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--red-light);
}

pre {
    background: var(--code-bg);
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow-x: auto;
    margin-bottom: 16px;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1.8;
}

/* ---- Cards ---- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
}

.card h3 {
    margin-top: 0;
    margin-bottom: 4px;
}

.card p:last-child { margin-bottom: 0; }

/* ---- Tips ---- */

.tip {
    background: var(--red-faint);
    border-left: 3px solid var(--red);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
    font-size: 13px;
    line-height: 1.6;
}

.tip strong {
    color: var(--red-light);
}

/* ---- Footer ---- */

footer {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
}

footer a {
    color: var(--text-muted);
}

footer a:hover {
    color: var(--accent);
}

/* ---- Nav at bottom of articles ---- */

.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.article-nav a {
    color: var(--text-muted);
}

.article-nav a:hover {
    color: var(--accent);
}
