/* AI Writer 发布文章：Citation 来源卡片与全部来源弹窗 */
.article-content .aiwriter-published-sources {
    clear: both;
    margin: 38px 0 8px;
    padding: 0;
    color: #202124;
    scroll-margin-top: 86px;
    text-align: left;
}

.article-content .aiwriter-published-sources > h2 {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    color: #202124;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
}

.aiw-source-heading-button {
    display: inline-flex;
    min-height: 32px;
    margin: -4px 0;
    padding: 4px 0;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

.aiw-source-heading-button svg {
    display: block;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    fill: none;
    stroke: #808791;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
}

.aiw-source-heading-button:hover svg {
    transform: translateX(2px);
}

.article-content .aiwriter-published-sources.is-enhanced > ol {
    display: none;
}

.aiw-source-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 82px;
    gap: 10px;
    margin: 0;
}

.article-content .aiw-source-card,
.aiw-source-modal .aiw-source-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 108px;
    padding: 16px 15px 13px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border: 1px solid #f0f1f3;
    border-radius: 8px;
    background: #f7f7f8;
    color: #25272b;
    text-decoration: none;
    text-indent: 0;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.article-content .aiw-source-card:hover,
.aiw-source-modal .aiw-source-card:hover {
    border-color: #dfe2e7;
    background: #fff;
    color: #17181b;
    box-shadow: 0 5px 18px rgba(28, 31, 35, .08);
    text-decoration: none;
}

.article-content .aiw-source-card:focus-visible,
.aiw-source-modal .aiw-source-card:focus-visible,
.aiw-source-heading-button:focus-visible,
.aiw-source-all:focus-visible,
.aiw-source-modal-close:focus-visible {
    outline: 3px solid rgba(69, 182, 247, .32);
    outline-offset: 2px;
}

.aiw-source-card-title {
    display: -webkit-box;
    overflow: hidden;
    color: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
    text-overflow: ellipsis;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.aiw-source-index {
    margin-right: 7px;
    color: #69707a;
    font-size: 16px;
    font-weight: 500;
}

.aiw-source-card-meta {
    display: flex;
    min-width: 0;
    margin-top: 13px;
    align-items: center;
    gap: 7px;
    color: #667085;
    font-size: 12px;
    line-height: 1.3;
}

.aiw-source-site-icon {
    display: block;
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    border-radius: 4px;
    background: transparent;
    object-fit: contain;
}

.aiw-source-site-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aiw-source-all {
    display: flex;
    min-height: 108px;
    padding: 12px 9px;
    align-items: center;
    justify-content: center;
    border: 1px solid #f0f1f3;
    border-radius: 8px;
    background: #f3f4f5;
    color: #25272b;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}

.aiw-source-all:hover {
    border-color: #dfe2e7;
    background: #e9eaec;
    color: #111317;
}

.article-content .aiw-source-ai-note {
    display: flex;
    min-height: 0;
    margin: 12px 0 0;
    padding: 0;
    align-items: center;
    gap: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #8f96a0;
    font-size: 12px;
    line-height: 1.4;
    text-indent: 0;
}

.aiw-source-info-icon {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0;
    flex: 0 0 14px;
    color: #8f96a0;
    line-height: 0;
    text-indent: 0;
}

.aiw-source-info-icon svg {
    display: block;
    width: 14px;
    height: 14px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.25;
    stroke-linecap: round;
}

.aiw-source-info-icon .aiw-source-info-dot {
    fill: currentColor;
    stroke: none;
}

.aiw-source-ai-text {
    min-width: 0;
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
    text-indent: 0;
}

body.aiw-source-modal-open {
    overflow: hidden;
}

.aiw-source-modal[hidden] {
    display: none;
}

.aiw-source-modal {
    position: fixed;
    z-index: 10020;
    inset: 0;
    display: flex;
    box-sizing: border-box;
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.aiw-source-modal * {
    box-sizing: border-box;
}

.aiw-source-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(21, 23, 27, .72);
    opacity: 0;
    transition: opacity .2s ease;
}

.aiw-source-modal-panel {
    position: relative;
    width: 680px;
    width: min(680px, 100%);
    max-width: 100%;
    max-height: 720px;
    max-height: min(74vh, 720px);
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .3);
    opacity: 0;
    transform: translateY(8px) scale(.985);
    transition: opacity .2s ease, transform .2s ease;
}

.aiw-source-modal.is-open .aiw-source-modal-backdrop,
.aiw-source-modal.is-open .aiw-source-modal-panel {
    opacity: 1;
}

.aiw-source-modal.is-open .aiw-source-modal-panel {
    transform: translateY(0) scale(1);
}

.aiw-source-modal-header {
    position: relative;
    display: flex;
    min-height: 72px;
    padding: 18px 64px 16px 28px;
    align-items: center;
    border-bottom: 1px solid #f0f1f3;
}

.aiw-source-modal-title {
    margin: 0;
    color: #202124;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
}

.aiw-source-modal-count {
    margin-left: 9px;
    color: #667085;
    font-size: 12px;
    font-weight: 400;
}

.aiw-source-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #858b94;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color .18s ease, color .18s ease;
}

.aiw-source-modal-close:hover {
    background: #f2f3f5;
    color: #303238;
}

.aiw-source-modal-close svg {
    width: 22px;
    height: 22px;
}

.aiw-source-modal-list {
    max-height: calc(74vh - 72px);
    max-height: calc(min(74vh, 720px) - 72px);
    padding: 14px 18px 22px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #aeb3bb transparent;
    scrollbar-width: thin;
}

.aiw-source-modal-list .aiw-source-card {
    min-height: 90px;
    margin-bottom: 10px;
    padding: 15px 16px 12px;
    background: #f8f8f9;
}

.aiw-source-modal-list .aiw-source-card:last-child {
    margin-bottom: 0;
}

.aiw-source-modal-list .aiw-source-card.is-targeted {
    border-color: #8dcdf2;
    background: #f1f9fe;
    box-shadow: 0 0 0 3px rgba(69, 182, 247, .14);
}

@media (max-width: 760px) {
    .article-content .aiwriter-published-sources {
        margin-top: 30px;
    }

    .article-content .aiwriter-published-sources > h2 {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .aiw-source-heading-button {
        min-height: 36px;
        margin: -6px 0;
        padding: 6px 0;
    }

    .aiw-source-preview {
        display: flex;
        gap: 10px;
        padding: 0 0 2px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 0;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .aiw-source-preview::-webkit-scrollbar {
        display: none;
    }

    .article-content .aiw-source-preview > .aiw-source-card {
        width: 82%;
        min-width: 260px;
        max-width: 340px;
        min-height: 104px;
        flex: 0 0 82%;
        scroll-snap-align: start;
    }

    .aiw-source-all {
        width: 72px;
        min-width: 72px;
        min-height: 104px;
        padding-inline: 8px;
        flex: 0 0 72px;
        scroll-snap-align: start;
    }

    .article-content .aiw-source-ai-note {
        margin-top: 9px;
    }

    .aiw-source-modal {
        padding: 16px;
    }

    .aiw-source-modal-panel {
        max-height: 82vh;
    }

    .aiw-source-modal-list {
        max-height: calc(82vh - 68px);
        padding: 12px;
    }

    .aiw-source-modal-header {
        min-height: 68px;
        padding: 16px 58px 14px 18px;
    }
}

@media (max-width: 480px) {
    .article-content .aiw-source-preview > .aiw-source-card {
        min-height: 102px;
    }

    .aiw-source-modal {
        padding: 10px;
        align-items: flex-end;
    }

    .aiw-source-modal-panel {
        width: 100%;
        max-height: 88vh;
        border-radius: 12px 12px 6px 6px;
    }

    .aiw-source-modal-list {
        max-height: calc(88vh - 68px);
    }

    .aiw-source-modal-title {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-content .aiw-source-card,
    .aiw-source-modal .aiw-source-card,
    .aiw-source-heading-button svg,
    .aiw-source-all,
    .aiw-source-modal-backdrop,
    .aiw-source-modal-panel,
    .aiw-source-modal-close {
        transition-duration: .01ms !important;
    }
}
