:root {
    --ink: #2f2b3f;
    --muted: #766f83;
    --primary: #6954a6;
    --primary-deep: #4d3c82;
    --lavender: #ebe5f7;
    --paper: #fffdf9;
    --background: #f8f6f1;
    --line: rgba(74, 59, 110, .12);
    --shadow: 0 24px 60px rgba(62, 46, 91, .12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

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

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

button {
    font: inherit;
}

.site-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.site-shell::before,
.site-shell::after {
    position: absolute;
    z-index: -1;
    display: block;
    width: 32rem;
    height: 32rem;
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.site-shell::before {
    top: -18rem;
    right: -13rem;
    background: rgba(218, 205, 245, .55);
}

.site-shell::after {
    top: 38rem;
    left: -24rem;
    background: rgba(235, 216, 194, .4);
}

.container {
    width: min(820px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
}

.brand img {
    width: 112px;
    height: auto;
}

.back-link {
    color: var(--muted);
    font-size: .88rem;
    transition: color .2s ease;
}

.back-link::before {
    margin-right: 7px;
    content: "←";
}

.back-link:hover,
.footer-inner a:hover,
.share-link-row a:hover {
    color: var(--primary);
}

.content-page {
    padding: 44px 0 90px;
}

.state-card {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 48px 24px;
    border: 1px solid var(--line);
    border-radius: 28px;
    color: var(--muted);
    background: rgba(255, 253, 249, .75);
    text-align: center;
}

.state-card p {
    margin: 12px 0 0;
}

.state-card.is-error {
    color: var(--primary-deep);
}

.state-card.is-error p {
    max-width: 420px;
}

.state-card .back-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary);
}

.loader {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(105, 84, 166, .18);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.article-card {
    padding: clamp(26px, 5vw, 58px);
    border: 1px solid rgba(74, 59, 110, .08);
    border-radius: 30px;
    background: rgba(255, 253, 249, .9);
    box-shadow: var(--shadow);
}

.article-heading {
    padding-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: .82rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 13px;
    border-radius: 999px;
    color: var(--primary-deep);
    background: var(--lavender);
    font-size: .76rem;
    font-weight: 700;
}

.article-card h1 {
    margin: 21px 0 17px;
    font-size: clamp(2rem, 6vw, 3.65rem);
    font-weight: 500;
    letter-spacing: -.055em;
    line-height: 1.2;
}

.article-summary {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.content-cover {
    display: block;
    width: 100%;
    max-height: 420px;
    margin-top: 26px;
    border-radius: 18px;
    object-fit: cover;
}

.markdown-body {
    padding: 34px 0 12px;
    color: #413b50;
    font-size: 1.03rem;
}

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body > :last-child {
    margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin: 1.8em 0 .55em;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -.025em;
    line-height: 1.35;
}

.markdown-body h1 {
    font-size: 1.85em;
}

.markdown-body h2 {
    font-size: 1.55em;
}

.markdown-body h3 {
    font-size: 1.3em;
}

.markdown-body p {
    margin: 0 0 1.12em;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0 0 1.12em;
    padding-left: 1.55em;
}

.markdown-body li + li {
    margin-top: .3em;
}

.markdown-body blockquote {
    margin: 1.35em 0;
    padding: 12px 18px;
    border-left: 4px solid #baa9dc;
    border-radius: 0 12px 12px 0;
    color: var(--muted);
    background: #f5f0fb;
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-body a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: rgba(105, 84, 166, .35);
    text-underline-offset: 3px;
}

.markdown-body code {
    padding: .13em .38em;
    border-radius: 5px;
    color: var(--primary-deep);
    background: #f0ebf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
}

.markdown-body pre {
    margin: 1.35em 0;
    padding: 16px 18px;
    overflow-x: auto;
    border-radius: 14px;
    color: #f7f3ff;
    background: #332b49;
    line-height: 1.6;
}

.markdown-body pre code {
    padding: 0;
    color: inherit;
    background: transparent;
    font-size: .88em;
}

.markdown-body hr {
    margin: 2em 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.markdown-body img {
    display: block;
    max-width: 100%;
    margin: 1.35em auto;
    border-radius: 14px;
}

.markdown-body table {
    display: block;
    width: 100%;
    margin: 1.35em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: .94em;
}

.markdown-body th,
.markdown-body td {
    min-width: 100px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    text-align: left;
}

.markdown-body th {
    color: var(--primary-deep);
    background: #f4effa;
    font-weight: 600;
}

.share-panel {
    margin-top: 32px;
    padding: 26px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-deep), #665397);
    box-shadow: 0 18px 40px rgba(62, 46, 91, .16);
}

.share-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.eyebrow {
    margin: 0 0 10px;
    color: #d8cdf2;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.share-panel h2 {
    margin: 0;
    font-size: clamp(1.2rem, 4vw, 1.65rem);
    font-weight: 500;
    letter-spacing: -.03em;
    line-height: 1.35;
}

.share-mark {
    display: grid;
    flex: 0 0 38px;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 50%;
    color: #e1d8f4;
    font-size: 1.25rem;
}

.share-copy {
    margin: 14px 0 17px;
    color: rgba(255, 255, 255, .72);
    font-size: .9rem;
}

.share-link-row {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 5px 6px 5px 13px;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 13px;
    background: rgba(255, 255, 255, .08);
}

.share-link-row a {
    min-width: 0;
    overflow: hidden;
    color: #f4efff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-button {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    cursor: pointer;
    font-size: .78rem;
}

.text-button:hover {
    background: rgba(255, 255, 255, .23);
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    margin-top: 15px;
    gap: 10px;
}

.action-status {
    min-height: 1.5em;
    margin: 10px 0 0;
    color: #d7f1e5;
    font-size: .78rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 700;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    color: var(--primary-deep);
    background: #fff;
    box-shadow: 0 9px 20px rgba(27, 16, 62, .16);
}

.button-primary:hover {
    background: #f7f3ff;
}

.button-subtle {
    border-color: rgba(255, 255, 255, .3);
    color: #fff;
    background: transparent;
}

.button-subtle:hover {
    background: rgba(255, 255, 255, .1);
}

.download-section {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-top: 24px;
    padding: 34px clamp(24px, 5vw, 45px);
    gap: 30px;
    border-radius: 26px;
    background: rgba(235, 229, 247, .76);
}

.download-section h2 {
    margin: 0 0 10px;
    color: var(--primary-deep);
    font-size: clamp(1.55rem, 4vw, 2.3rem);
    font-weight: 500;
    letter-spacing: -.045em;
    line-height: 1.25;
}

.download-section p:not(.eyebrow):not(.download-note) {
    max-width: 570px;
    margin: 0 0 19px;
    color: var(--muted);
    font-size: .93rem;
}

.download-section .eyebrow {
    color: var(--primary);
}

.button-light {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(105, 84, 166, .22);
}

.button-light:hover {
    background: var(--primary-deep);
}

.download-note {
    margin: 13px 0 0;
    color: #958d9b;
    font-size: .76rem;
}

.download-symbol {
    display: grid;
    place-items: center;
    width: 128px;
    height: 128px;
    border: 1px solid rgba(105, 84, 166, .18);
    border-radius: 50%;
    color: var(--primary-deep);
    background: rgba(255, 253, 249, .6);
}

.download-symbol span {
    display: block;
    margin-top: -8px;
    font-size: 2.8rem;
    line-height: 1;
}

.download-symbol small {
    display: block;
    margin-top: -29px;
    font-size: .48rem;
    letter-spacing: .18em;
    line-height: 1.4;
    text-align: center;
}

.site-footer {
    padding: 0 0 32px;
    color: #958d9b;
    font-size: .76rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 19px;
    border-top: 1px solid var(--line);
    gap: 18px;
}

.footer-brand {
    display: inline-flex;
    flex: 0 0 auto;
}

.footer-brand img {
    width: 90px;
    height: auto;
}

.footer-inner > a:last-child {
    flex: 0 0 auto;
    color: var(--primary);
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 28px, 820px);
    }

    .topbar {
        min-height: 67px;
    }

    .brand img {
        width: 100px;
    }

    .content-page {
        padding-top: 30px;
        padding-bottom: 60px;
    }

    .article-card {
        padding: 24px 19px;
        border-radius: 23px;
    }

    .article-card h1 {
        font-size: clamp(1.8rem, 10vw, 2.8rem);
    }

    .markdown-body {
        padding-top: 26px;
        font-size: .98rem;
    }

    .share-panel {
        padding: 21px 18px;
        border-radius: 18px;
    }

    .share-link-row {
        align-items: flex-start;
    }

    .share-link-row a {
        padding-top: 7px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .download-section {
        grid-template-columns: 1fr;
        padding: 29px 21px;
    }

    .download-symbol {
        justify-self: center;
        width: 104px;
        height: 104px;
    }

    .download-symbol span {
        font-size: 2.3rem;
    }

    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }
}
