﻿code:not(pre code) {
    padding: 0.2em 0.4em;
    border-radius: 6px;
    background: color-mix(in srgb, var(--main-color) 15%, transparent);
    color: var(--main-color);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 85%;
    text-wrap: nowrap;
    white-space: nowrap;
}

kbd {
    display: inline-block;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 10px;
    color: var(--text-color);
    vertical-align: middle;
    background-color: var(--bg-color);
    border: solid 1px var(--footer-border);
    border-bottom-color: var(--footer-border);
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 var(--footer-border);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.markdown-body {
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    min-width: 0;
    line-height: 1.8;
    font-size: 16px;
    color: var(--text-color);
}

    .markdown-body p {
        margin-top: 0;
        margin-bottom: 1.2rem;
    }

    .markdown-body a {
        color: var(--link-color);
        text-decoration: none;
        font-weight: 500;
        transition: color 0.2s;
    }

        .markdown-body a:hover {
            color: var(--main-deep-color);
            text-decoration: underline;
        }

    .markdown-body hr {
        color: var(--main-color);
        background: var(--main-color);
        height: 4px;
        border-radius: 999px;
        margin-top: 25px;
        margin-bottom: 25px;
        opacity: .5;
    }

    .markdown-body pre {
        overflow-x: auto;
        max-width: 100%;
        white-space: pre;
    }

    .markdown-body h1 {
        margin: 2em 0 1em;
        padding-bottom: 0.3em;
        border-bottom: 1px solid var(--footer-border);
        font-weight: 700;
    }

    .markdown-body h2 {
        margin: 1.8em 0 1em;
        padding-bottom: 0.3em;
        border-bottom: 1px solid var(--footer-border);
        font-weight: 600;
    }

    .markdown-body h3 {
        margin: 1.5em 0 1em;
        font-weight: 600;
    }

    .markdown-body h4 {
        margin: 1.4em 0 0.6em;
    }

    .markdown-body h5 {
        margin: 1.2em 0 0.5em;
    }

    .markdown-body h6 {
        margin: 1em 0 0.4em;
    }

        .markdown-body h1:first-child,
        .markdown-body h2:first-child,
        .markdown-body h3:first-child,
        .markdown-body h4:first-child,
        .markdown-body h5:first-child,
        .markdown-body h6:first-child {
            margin-top: 0.5em;
        }

    .markdown-body img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
        border: 3px solid color-mix(in srgb, var(--main-color) 40%, transparent);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        margin: 1rem 0;
        display: inline-block;
        transition: all 0.3s ease;
    }

        .markdown-body img:hover {
            border-color: var(--main-color);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
        }

    .markdown-body table {
        display: block;
        width: 100%;
        width: max-content;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-spacing: 0;
        border-collapse: collapse;
        margin-bottom: 1rem;
    }

        .markdown-body table tr {
            background-color: var(--bg-color);
            border-top: 1px solid var(--footer-border);
        }

            .markdown-body table tr:nth-child(2n) {
                background-color: color-mix(in srgb, var(--text-color) 3%, transparent);
            }

        .markdown-body table th,
        .markdown-body table td {
            padding: 6px 13px;
            border: 1px solid var(--footer-border);
        }

        .markdown-body table th {
            font-weight: 600;
            background-color: color-mix(in srgb, var(--text-color) 5%, transparent);
        }

    .markdown-body blockquote {
        color: var(--text-secondary-color);
        border-left: 4px solid var(--main-color);
        background-color: var(--focus-main-color);
        padding: 0.5rem 1rem;
        margin: 1rem 0;
        border-radius: 0 0.5rem 0.5rem 0;
    }

        .markdown-body blockquote > :last-child {
            margin-bottom: 0;
        }

    /* List Styles */
    .markdown-body ul,
    .markdown-body ol {
        padding-left: 1.8em;
        margin-top: 0.5em;
        margin-bottom: 1.2rem;
    }

    .markdown-body ul {
        list-style-type: disc;
    }

    .markdown-body ol {
        list-style-type: decimal;
    }

    .markdown-body li {
        margin-top: 0.4em;
        line-height: 1.7;
        position: relative;
        padding-left: 0.2em;
    }

        /* Enhancing Markers */
        .markdown-body li::marker {
            color: var(--main-color);
            font-weight: bold;
            font-size: 1.05em;
            transition: color 0.2s ease;
        }

        .markdown-body li:hover::marker {
            color: var(--main-deep-color);
        }

    /* Nested Lists */
    .markdown-body ul ul,
    .markdown-body ul ol,
    .markdown-body ol ol,
    .markdown-body ol ul {
        margin-top: 0.3em;
        margin-bottom: 0.3em;
        padding-left: 1.5em;
    }

    /* Varied bullets for nested lists */
    .markdown-body ul ul {
        list-style-type: circle;
    }

        .markdown-body ul ul ul {
            list-style-type: square;
        }

    /* Checkbox Styles */
    .markdown-body input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: 1.25em;
        height: 1.25em;
        vertical-align: text-bottom;
        background-color: transparent;
        border: 2px solid var(--text-secondary-color);
        border-radius: 4px;
        cursor: default;
        position: relative;
        margin-right: 0.25em;
        transition: all 0.2s ease;
    }

        .markdown-body input[type="checkbox"]:checked {
            background-color: var(--main-color);
            border-color: var(--main-color);
        }

            .markdown-body input[type="checkbox"]:checked::after {
                content: "✓";
                position: absolute;
                color: var(--bg-color);
                font-size: 0.9em;
                font-weight: bold;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
                line-height: 1;
            }

    .markdown-body .task-list-item {
        list-style-type: none;
        margin-left: -1.5em; /* Offset for list items without bullets */
        display: flex;
        align-items: flex-start;
    }

        .markdown-body .task-list-item input[type="checkbox"] {
            margin-top: 0.15em; /* Vertical alignment with text */
            flex-shrink: 0;
        }

    /* Footnotes Styling */
    .markdown-body .footnotes {
        margin-top: 4rem;
        padding: 2rem;
        border-radius: 12px;
        background-color: color-mix(in srgb, var(--main-color) 2%, var(--bg-color));
        border: 1px solid var(--footer-border);
        font-size: 0.9em;
        color: var(--text-secondary-color);
        position: relative;
    }

        .markdown-body .footnotes::before {
            content: "注释";
            position: absolute;
            top: -12px;
            left: 20px;
            background-color: var(--bg-color); /* Match page bg to hide border behind text */
            padding: 0 10px;
            font-weight: 600;
            color: var(--text-secondary-color);
            font-size: 0.85em;
            border-radius: 4px;
            /* Optional: Small border matching the container to make it look like a label */
            border: 1px solid var(--footer-border);
        }
        /* If contained in a card with different bg, adjust above. Assuming .markdown-body is on var(--bg-color) */

        .markdown-body .footnotes ol {
            padding-left: 1.5rem;
            list-style-type: decimal;
            margin-bottom: 0;
        }

        .markdown-body .footnotes li {
            margin-bottom: 0.8rem;
            padding: 1rem 0.8rem 0rem 0.8rem;
            border-radius: 8px;
            transition: all 0.3s ease;
            border: 1px solid transparent;
        }

            .markdown-body .footnotes li:last-child {
                margin-bottom: 0;
            }

            /* Ensure marker fits the theme */
            .markdown-body .footnotes li::marker {
                color: var(--main-color);
                font-weight: 600;
            }

    /* Back-to-text link arrow */
    .markdown-body .footnote-backref {
        color: var(--main-color);
        text-decoration: none;
        margin-left: 0.5rem;
        font-family: system-ui, -apple-system, sans-serif;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.25em;
        height: 1.25em;
        border-radius: 50%;
        background-color: color-mix(in srgb, var(--main-color) 10%, transparent);
        transition: all 0.2s ease;
        font-size: 0.9em;
    }

        .markdown-body .footnote-backref:hover {
            background-color: var(--main-color);
            color: var(--bg-color);
            transform: translateY(-2px);
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

/* When clicking a footnote link, highlight the footnote content */
@keyframes highlight-pulse {
    0% {
        border-color: var(--main-color);
        background-color: var(--focus-main-color);
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        border-color: var(--main-color);
        background-color: var(--focus-main-color);
        transform: scale(1);
    }
}

.markdown-body .footnotes li:target {
    border-color: var(--main-color);
    background-color: var(--focus-main-color);
    animation: highlight-pulse 0.5s ease-out;
}

/* Footnote references in text [^1] */
.markdown-body .footnote-ref {
    color: var(--main-color);
    text-decoration: none;
    font-weight: 700;
    margin: 0 0.15rem;
    padding: 0.4em 0.3em 0.1em 0.3em;
    border-radius: 6px;
    font-size: 0.75em;
    vertical-align: super;
    line-height: 1;
    background-color: color-mix(in srgb, var(--main-color) 8%, transparent);
    transition: all 0.2s ease;
    display: inline-block;
}

    .markdown-body .footnote-ref sup::before {
        content: "[";
        opacity: 0.8;
        margin-right: 1px;
    }

    .markdown-body .footnote-ref sup::after {
        content: "]";
        opacity: 0.8;
        margin-left: 1px;
    }
