:root {
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --bg:             #f8fafc;
    --bg-card:        #ffffff;
    --text:           #1e293b;
    --text-secondary: #64748b;
    --border:         #e2e8f0;
    --tag-bg:         #eff6ff;
    --tag-color:      #3b82f6;
    --radius:         12px;
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --code-bg:        #f1f5f9;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

a { color: inherit; text-decoration: none; }

/* ── Navigation ─────────────────────────────────────── */
nav {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.nav-links a {
    margin-left: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color .2s;
}
.nav-links a:hover { color: var(--primary); }

@keyframes cps-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249,115,22,.55), 0 3px 10px rgba(239,68,68,.4); }
    60%       { box-shadow: 0 0 0 7px rgba(249,115,22,.0),  0 3px 10px rgba(239,68,68,.4); }
}
.nav-cps {
    background: linear-gradient(135deg, #ff6a00, #ee0979);
    color: #fff !important;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .3px;
    box-shadow: 0 3px 10px rgba(239,68,68,.4);
    animation: cps-pulse 2s ease-in-out infinite;
    transition: transform .15s, filter .15s;
    white-space: nowrap;
}
.nav-cps:hover {
    color: #fff !important;
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.1);
    animation: none;
}

/* ── Hero ────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
    color: #fff;
    text-align: center;
    padding: 80px 24px 88px;
}

.hero h1 {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.hero p {
    font-size: 18px;
    opacity: .85;
}

/* ── Main layout ─────────────────────────────────────── */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

section + section { margin-top: 72px; }

.section-title {
    margin-bottom: 32px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.section-title h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ── Post cards ──────────────────────────────────────── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,.08), 0 12px 28px rgba(0,0,0,.1);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.tag {
    background: var(--tag-bg);
    color: var(--tag-color);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
}

.date {
    font-size: 13px;
    color: var(--text-secondary);
}

.post-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.45;
}

.post-card h3 a:hover { color: var(--primary); }

.post-card > p {
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
    margin-bottom: 16px;
}

.read-more {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    transition: color .2s;
}
.read-more:hover { color: var(--primary-dark); }

/* ── About card ──────────────────────────────────────── */
.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

.about-avatar {
    width: 72px;
    height: 72px;
    min-width: 72px;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -1px;
}

.about-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.about-content > p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 15px;
}

.about-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.about-tags span {
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 3px 12px;
    border-radius: 999px;
    color: var(--text-secondary);
}

/* ── Footer ──────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
}

footer a { color: var(--primary); }
footer p + p { margin-top: 6px; font-size: 13px; }

/* ── Post article page ───────────────────────────────── */
.post-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    transition: color .2s;
}
.back-link:hover { color: var(--primary); }

.post-article .post-header {
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.post-article .post-header h1 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    line-height: 1.3;
    margin-top: 14px;
    letter-spacing: -.5px;
}

.post-body { font-size: 16px; }

.post-body h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.post-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 12px;
}

.post-body p { margin-bottom: 16px; color: var(--text); }

.post-body ul, .post-body ol {
    margin: 0 0 16px 24px;
}

.post-body li { margin-bottom: 6px; }

.post-body pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Consolas', 'Monaco', monospace;
}

.post-body code {
    background: var(--code-bg);
    color: #e11d48;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.post-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.post-body blockquote {
    border-left: 4px solid var(--primary);
    margin: 20px 0;
    padding: 12px 20px;
    background: var(--tag-bg);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.post-body th, .post-body td {
    border: 1px solid var(--border);
    padding: 10px 16px;
    text-align: left;
}

.post-body th {
    background: var(--bg);
    font-weight: 600;
}

.post-body tr:hover td { background: var(--bg); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .about-card   { flex-direction: column; align-items: center; text-align: center; }
    .about-tags   { justify-content: center; }
    .posts-grid   { grid-template-columns: 1fr; }
    .hero         { padding: 56px 20px 64px; }

    /* 导航两行布局：第一行 Logo，第二行链接 + CPS 按钮 */
    .nav-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 10px 16px;
        row-gap: 8px;
    }
    .nav-links {
        width: 100%;
        display: flex;
        align-items: center;
    }
    .nav-links a          { margin-left: 0; font-size: 13px; }
    .nav-links a + a      { margin-left: 14px; }
    .nav-cps {
        margin-left: auto;   /* 把按钮顶到最右边 */
        font-size: 12px;
        padding: 5px 11px;
        letter-spacing: 0;
    }
}
