/* 网盘链接自动转换 - 前端样式 */

.ndul-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 8px;
    margin: 0 2px;
    border-radius: 5px;
    border: 1px solid transparent;
    font-size: 0.92em;
    line-height: 1.6;
    text-decoration: none;
    vertical-align: baseline;
    word-break: break-all;
    transition: opacity .15s ease, box-shadow .15s ease;
}

.ndul-link:hover {
    opacity: .82;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    text-decoration: none;
}

.ndul-link:visited {
    /* keep brand color, do not turn purple */
}

.ndul-badge {
    display: inline-block;
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    font-weight: 600;
    flex-shrink: 0;
}

.ndul-url {
    color: inherit;
    word-break: break-all;
}

.ndul-text {
    color: inherit;
    font-weight: 500;
}

/* 提取码 / 密码 标签 */
.ndul-pwd {
    display: inline-block;
    margin: 0 4px;
    font-size: 0.9em;
    vertical-align: baseline;
}

.ndul-pwd-label {
    color: #8a8a8a;
    margin-right: 2px;
}

.ndul-pwd-code {
    display: inline-block;
    background: #fff7e6;
    color: #fa8c16;
    border: 1px dashed #fa8c16;
    padding: 0 8px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    -webkit-user-select: all;
    -moz-user-select: all;
    -ms-user-select: all;
    user-select: all;
}

.ndul-pwd-code:hover {
    background: #fff1d6;
}

/* 让整段在窄屏下不溢出 */
.ndul-demo,
:where(p, div, li, dd, blockquote) .ndul-link {
    overflow-wrap: anywhere;
}

/* 加高网盘链接之间的行距 */
.ndul-link {
    margin: 6px 2px;
    line-height: 2;
}

.ndul-pwd {
    line-height: 2;
}

/* 含网盘链接的段落：增加上下间距与行高 */
:where(p, div, li):has(.ndul-link) {
    margin-top: 0.7em;
    margin-bottom: 1.3em;
    line-height: 2;
}

/* 两个网盘链接段落相邻时，间距再拉大一点 */
:where(p, div, li):has(.ndul-link) + :where(p, div, li):has(.ndul-link) {
    margin-top: 1.8em;
}

/* 不支持 :has() 的旧浏览器兜底：靠链接自身 margin 撑开 */
@supports not (selector(:has(*))) {
    .ndul-link {
        margin: 10px 2px;
    }
}
