*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

:root {
    --bg: #f8f9fb;
    --card: #fff;
    --text: #1e293b;
    --text2: #475569;
    --text3: #94a3b8;
    --accent: #5b6abf;
    --tag: #eef0ff;
    --tag-text: #5b6abf;
    --border: #e8ecf1;
    --shadow: 0 1px 4px rgba(0,0,0,.05),0 2px 12px rgba(0,0,0,.03);
    --radius: 14px;
    --max: 1280px;
    --font: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;
}

html {
    font-size: 17px;
    scroll-behavior: smooth;
    overflow-x: hidden
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: .02em;
}

a {
    color: inherit;
    text-decoration: none
}

img {
    max-width: 100%;
    display: block
}

::selection {
    background: #dbeafe;
    color: #1e3a5f
}

::-moz-selection {
    background: #dbeafe;
    color: #1e3a5f
}

/* ===== Nav ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border)
}

.nav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 8px
}

.nav-brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--accent);
    margin-right: auto;
    white-space: nowrap;
    letter-spacing: .03em
}

    .nav-brand span {
        color: var(--text2);
        font-weight: 400;
        font-size: .9rem
    }

.nav-links {
    display: flex;
    gap: 2px;
    flex-wrap: wrap
}

    .nav-links a {
        padding: 7px 14px;
        border-radius: 10px;
        font-size: .88rem;
        color: var(--text2);
        transition: all .2s;
        font-weight: 500
    }

        .nav-links a:hover {
            background: var(--tag);
            color: var(--accent)
        }

        #navLogin {
            font-weight: 700
        }

        .nav-links a.logged-in {
            color: var(--accent);
            font-weight: 700;
            background: rgba(91,106,191,.1)
        }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px
}

    .nav-toggle svg {
        width: 22px;
        height: 22px;
        stroke: var(--text);
        fill: none;
        stroke-width: 2
    }

/* ===== Hero ===== */
.noe {
    display: none
}

.hero {
    position: relative;
    overflow: hidden;
    height: 56px;
    background: #0f0b1e
}

    .hero::before {
        content: "";
        position: absolute;
        inset: -40%;
        background: conic-gradient(from 0deg at 50% 50%, #6366f1 0%,#a855f7 15%,#ec4899 30%,#f97316 45%, #eab308 55%,#22d3ee 70%,#6366f1 85%,#a855f7 100%);
        filter: blur(40px) saturate(1.4);
        opacity: .55;
        animation: auroraSpin 10s linear infinite
    }

    .hero::after {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(ellipse 80% 100% at 50% 120%,rgba(99,102,241,.4),transparent), radial-gradient(ellipse 60% 80% at 20% 50%,rgba(168,85,247,.25),transparent), radial-gradient(ellipse 60% 80% at 80% 50%,rgba(236,72,153,.2),transparent);
        animation: breathe 5s ease-in-out infinite alternate
    }

    .hero .glow-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg,transparent,#a855f7,#6366f1,#22d3ee,transparent);
        opacity: .7;
        animation: glowSlide 4s ease-in-out infinite
    }

    .hero .stars {
        position: absolute;
        inset: 0
    }

        .hero .stars span {
            position: absolute;
            width: 2px;
            height: 2px;
            background: #fff;
            border-radius: 50%;
            animation: twinkle 3s ease-in-out infinite
        }

/* ===== Wave ===== */
.wave {
    position: relative;
    margin-top: -1px;
    height: 20px;
    background: var(--bg);
    overflow: hidden
}

    .wave svg {
        position: absolute;
        top: 0;
        width: 100%;
        height: 20px
    }

/* ===== Layout ===== */
.main, .wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 28px 56px;
    display: grid;
    gap: 36px
}

.main {
    grid-template-columns: minmax(0,1fr) 300px
}

.wrap {
    grid-template-columns: 1fr 280px
}

    .main > *,
    .wrap > * {
        min-width: 0;
    }

/* ===== Card ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 26px 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: transform .3s,box-shadow .3s,border-color .3s;
    animation: fadeUp .5s ease both
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 28px rgba(91,106,191,.1);
        border-left-color: var(--accent)
    }

/* ===== Card Content (list cards) ===== */
.card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap
}

    .card-head a {
        font-size: 1.08rem;
        font-weight: 700;
        color: var(--text);
        line-height: 1.5;
        transition: color .2s
    }

        .card-head a:hover {
            color: var(--accent)
        }

.card-desc {
    color: var(--text2);
    font-size: .93rem;
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .82rem
}

.date {
    color: var(--text3)
}

/* ===== Tag ===== */
.tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .02em
}

    .tag[data-c="code"] {
        background: #eef0ff;
        color: #5b6abf
    }

    .tag[data-c="edu"] {
        background: #ecfdf5;
        color: #059669
    }

    .tag[data-c="tool"] {
        background: #fef3c7;
        color: #d97706
    }

    .tag[data-c="life"] {
        background: #fce7f3;
        color: #db2777
    }

/* ===== Articles list (home) ===== */
.articles {
    display: flex;
    flex-direction: column;
    gap: 12px
}

    .articles .card {
        padding: 22px 26px
    }
/* 卡片交错动画延迟已移至 common.js 动态设置，以精简 CSS */

/* ===== Page header (list pages) ===== */
.page-head {
    margin-bottom: 24px;
    animation: fadeUp .4s ease both
}

    .page-head h2 {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--text)
    }

    .page-head span {
        font-size: .82rem;
        color: var(--text3)
    }

/* ===== Pagination ===== */
.pager {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    animation: fadeUp .6s ease both
}

    .pager a, .pager span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        height: 38px;
        padding: 0 14px;
        border-radius: 10px;
        font-size: .88rem;
        font-weight: 600;
        transition: all .2s
    }

    .pager span {
        background: var(--accent);
        color: #fff
    }

    .pager a {
        background: var(--card);
        color: var(--text2);
        border: 1px solid var(--border)
    }

        .pager a:hover {
            background: var(--tag);
            color: var(--accent);
            border-color: var(--accent)
        }

/* ===== Sidebar ===== */
.side {
    position: sticky;
    top: 80px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 24px
}

.side-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border)
}

    .side-card img {
        border-radius: 10px;
        margin-bottom: 12px
    }

.side-label {
    text-align: center;
    font-size: .82rem;
    color: var(--text3);
    margin-bottom: 18px
}

.side-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px
}

    .side-title::before {
        content: "🔥";
        font-size: 1.1rem
    }

/* ===== Hot list ===== */
.hot-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    counter-reset: hot
}

    .hot-list li {
        counter-increment: hot
    }

        .hot-list li a {
            display: flex;
            align-items: baseline;
            gap: 12px;
            padding: 9px 12px;
            border-radius: 10px;
            font-size: .88rem;
            color: var(--text2);
            transition: all .2s
        }

            .hot-list li a::before {
                content: counter(hot);
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 22px;
                height: 22px;
                border-radius: 7px;
                font-size: .72rem;
                font-weight: 700;
                flex-shrink: 0
            }

        .hot-list li:nth-child(-n+3) a::before {
            background: var(--accent);
            color: #fff
        }

        .hot-list li:nth-child(n+4) a::before {
            background: #f0f2f5;
            color: var(--text3)
        }

        .hot-list li a:hover {
            background: var(--tag);
            color: var(--accent)
        }

/* ===== Ad / Side links ===== */
.ad-title {
    font-size: .88rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text)
}

.ad-link {
    display: block;
    padding: 7px 0;
    font-size: .84rem;
    color: #e11d48;
    transition: color .2s
}

    .ad-link:hover {
        color: var(--accent)
    }

/* ===== Article detail ===== */
.article-head {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border)
}

    .article-head h1 {
        font-size: 1.55rem;
        font-weight: 800;
        line-height: 1.5;
        margin-bottom: 14px
    }

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: .84rem;
    color: var(--text3);
    flex-wrap: wrap
}

    .article-meta .date {
        display: flex;
        align-items: center;
        gap: 5px
    }

        .article-meta .date::before {
            content: "📅";
            font-size: .85rem
        }

    .article-meta .source {
        display: flex;
        align-items: center;
        gap: 5px
    }

        .article-meta .source::before {
            content: "✍️";
            font-size: .85rem
        }

.article-body {
    font-size: 1rem;
    line-height: 1.95;
    color: var(--text);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    overflow: hidden;
    min-width: 0;
}

    .article-body p {
        margin-bottom: 1.3em
    }

    .article-body img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
        margin: 20px 0;
        box-shadow: 0 4px 16px rgba(0,0,0,.06);
        transition: transform .3s ease;
    }

        .article-body img:hover {
            transform: scale(1.01);
        }

    .article-body h2 {
        font-size: 1.25rem;
        font-weight: 700;
        margin: 32px 0 14px;
        color: var(--accent);
        padding-left: 14px;
        border-left: 3px solid var(--accent)
    }

    .article-body h3 {
        font-size: 1.1rem;
        font-weight: 700;
        margin: 24px 0 12px
    }

    .article-body pre {
        background: #1e293b;
        color: #e2e8f0;
        padding: 20px 24px;
        border-radius: 12px;
        overflow-x: auto;
        font-size: .88rem;
        line-height: 1.7;
        margin: 20px 0;
        max-width: 100%;
        box-sizing: border-box;
        white-space: pre;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,0.25) transparent;
    }

        .article-body pre::-webkit-scrollbar {
            height: 6px;
        }

        .article-body pre::-webkit-scrollbar-track {
            background: rgba(255,255,255,0.05);
            border-radius: 6px;
        }

        .article-body pre::-webkit-scrollbar-thumb {
            background: rgba(255,255,255,0.25);
            border-radius: 6px;
        }

    .article-body code {
        font-family: 'Fira Code','Cascadia Code','JetBrains Mono',monospace
    }

    .article-body blockquote {
        border-left: 3px solid var(--accent);
        padding: 14px 20px;
        margin: 20px 0;
        background: var(--tag);
        border-radius: 0 10px 10px 0;
        color: var(--text2);
        font-size: .95rem
    }

    .article-body ul, .article-body ol {
        padding-left: 1.6em;
        margin-bottom: 1.3em
    }

    .article-body li {
        margin-bottom: .5em
    }

    .article-body a {
        color: var(--accent);
        text-decoration: none;
        border-bottom: 1px solid transparent;
        transition: border-color .2s
    }

        .article-body a:hover {
            border-bottom-color: var(--accent)
        }

.article-footer {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

    .article-footer .tag {
        font-size: .82rem;
        padding: 4px 14px
    }

/* ===== Bottom section (detail page) ===== */
.bottom-section {
    margin-top: 32px;
    animation: fadeUp .5s ease .15s both
}

.poem-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px 36px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    position: relative;
    overflow: hidden
}

    .poem-card::before {
        content: "📖";
        position: absolute;
        top: 14px;
        right: 18px;
        font-size: 1.5rem;
        opacity: .12
    }

.poem-label {
    font-size: .78rem;
    color: var(--text3);
    letter-spacing: 3px;
    margin-bottom: 18px;
    text-transform: uppercase
}

.poem-text {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 2.4;
    font-style: italic;
    max-width: 420px;
    margin: 0 auto
}

    .poem-text span {
        display: block
    }

.poem-author {
    font-size: .85rem;
    color: var(--accent);
    margin-top: 16px;
    font-weight: 600
}

.action-row {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px
}

.action-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: center;
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0
}

    .action-icon.qr {
        background: linear-gradient(135deg,#eef2ff,#e0e7ff)
    }

    .action-icon.pay {
        background: linear-gradient(135deg,#fef3c7,#fde68a)
    }

.action-info {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

    .action-info h4 {
        font-size: .92rem;
        font-weight: 700;
        margin-bottom: 5px;
        color: var(--text)
    }

    .action-info p {
        font-size: .8rem;
        color: var(--text3);
        line-height: 1.6
    }

    .action-info .link {
        color: var(--accent);
        font-size: .8rem;
        margin-top: 7px;
        display: inline-block
    }

        .action-info .link:hover {
            text-decoration: underline
        }

.action-qr {
    width: 120px;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06)
}

/* ===== Timeline (growth page) ===== */
.tl {
    position: relative;
    padding-left: 32px
}

    .tl::before {
        content: "";
        position: absolute;
        left: 9px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: linear-gradient(180deg,var(--accent),#c7d2fe)
    }

.tl-item {
    position: relative;
    margin-bottom: 32px;
    animation: fadeUp .5s ease both
}

    .tl-item:nth-child(2) {
        animation-delay: .12s
    }

    .tl-item::before {
        content: "";
        position: absolute;
        left: -27px;
        top: 6px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--accent);
        border: 3px solid var(--bg);
        box-shadow: 0 0 0 2px var(--accent)
    }

.tl-date {
    font-size: .78rem;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: .5px
}

.tl-title {
    font-size: 1.08rem;
    font-weight: 700;
    margin-bottom: 8px
}

.tl-desc {
    font-size: .93rem;
    color: var(--text2);
    line-height: 1.75
}

/* ===== About page ===== */
.card h2 {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    padding-left: 14px;
    border-left: 3px solid var(--accent)
}

.card p {
    color: var(--text2);
    font-size: .95rem;
    margin-bottom: 18px;
    line-height: 1.85
}

    .card p:last-child {
        margin-bottom: 0
    }

.card section + section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border)
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    text-align: center
}

    .footer p {
        font-size: .78rem;
        color: var(--text3);
        line-height: 1.6
    }

    .footer a {
        color: var(--text3);
        border-bottom: 1px dashed var(--border);
        transition: color .2s
    }

        .footer a:hover {
            color: var(--accent);
            border-color: var(--accent)
        }

/* ===== Back to top ===== */
.top-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(91,106,191,.3);
    transition: transform .25s,box-shadow .25s,opacity .3s;
    z-index: 50
}

    .top-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 24px rgba(91,106,191,.45)
    }

/* ===== Article card (detail page override) ===== */
.card.article-card {
    padding: 32px
}

/* ===== Keyframes ===== */
@keyframes grad {
    0% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0% 50%
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes auroraSpin {
    from {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(360deg)
    }
}

@keyframes breathe {
    0% {
        opacity: .6
    }

    100% {
        opacity: 1
    }
}

@keyframes glowSlide {
    0%,100% {
        transform: translateX(-30%);
        opacity: .4
    }

    50% {
        transform: translateX(30%);
        opacity: .8
    }
}

@keyframes twinkle {
    0%,100% {
        opacity: .2;
        transform: scale(.8)
    }

    50% {
        opacity: 1;
        transform: scale(1.3)
    }
}

/* ===== Pay Gate (付费内容遮罩) ===== */
.pay-gate {
    position: relative;
    margin-top: 20px;
    padding: 30px 24px;
    background: linear-gradient(135deg,#fef9ee 0%,#fff6e0 100%);
    border: 2px dashed #f0c040;
    border-radius: var(--radius);
    text-align: center;
}

.pay-gate-inner {
    max-width: 520px;
    margin: 0 auto
}

.pay-tip {
    font-size: 1.1rem;
    font-weight: 700;
    color: #b8860b;
    margin-bottom: 4px
}

.pay-price {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 4px
}

    .pay-price strong {
        font-size: 1.3rem;
        color: #e65100;
        font-weight: 800
    }

.pay-note {
    font-size: .92rem;
    color: var(--text2);
    margin-bottom: 10px
}

    .pay-note strong {
        color: #d84315;
        font-weight: 700;
        letter-spacing: .05em
    }

.pay-action {
    margin-bottom: 12px
}

.btn-pay-done {
    display: inline-block;
    padding: 12px 36px;
    background: linear-gradient(135deg,#ff9800,#f57c00);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all .25s;
    box-shadow: 0 4px 14px rgba(255,152,0,.35);
}

    .btn-pay-done:hover {
        background: linear-gradient(135deg,#f57c00,#e65100);
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(255,152,0,.45)
    }

    .btn-pay-done:disabled {
        opacity: .6;
        cursor: not-allowed;
        transform: none
    }

.pay-gate .pay-qr {
    display: block;
    width: 180px;
    margin: 0 auto 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1)
}

.pay-msg {
    font-size: .88rem;
    color: var(--text2);
    min-height: 22px;
    margin-top: 4px
}

.pay-msg-warn {
    color: #e65100;
    font-weight: 600
}

.pay-msg-error {
    color: #c62828;
    font-weight: 600
}

.paid-content-box {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--border)
}

/* ===== Responsive ===== */
/* ===== Reduced motion ===== */
@media(prefers-reduced-motion:reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important
    }
}

/* ===== Mid breakpoint ===== */
@media(max-width:900px)and(min-width:769px) {
    .main {
        grid-template-columns: 1fr 240px
    }

    .wrap {
        grid-template-columns: 1fr 220px
    }
}

/* ===== Mobile ===== */
@media(max-width:768px) {
    html {
        font-size: 16px
    }

    .main, .wrap {
        grid-template-columns: 1fr;
        padding: 0 20px 48px
    }

    .side {
        position: static
    }

    .action-row {
        grid-template-columns: 1fr
    }

    .article-head h1 {
        font-size: 1.3rem
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #fff;
        padding: 14px;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 20px rgba(0,0,0,.06)
    }

        .nav-links.open {
            display: flex
        }

    .nav-toggle {
        display: block;
        margin-left: auto
    }

    .hero {
        height: 36px
    }

    .wave {
        height: 12px
    }

    .hero h1 {
        font-size: 1.2rem
    }

    .hero p {
        font-size: .8rem
    }

    .hero::before {
        animation: none;
        filter: blur(20px) saturate(1.2);
        opacity: .35
    }

    .hero::after {
        animation: none
    }

    .hero .stars span {
        animation: none
    }
}
