/*
 * DuckWow 作者专区徽章弹框（app / 网址详情页，仅桌面端）
 * 入口卡片：.dw-author-card（侧边栏规格速览下方）
 * 弹框：.dwbm-*（wp_footer 输出）
 * 夜间模式挂载点：html 上的 .io-black-mode（与全站一致）
 */

/* ---------- 侧边栏入口卡片 ---------- */

.dw-author-card .app-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dw-author-card-ico {
    color: var(--theme-color, #00aa90);
    flex: 0 0 auto;
}

.dw-author-card-desc {
    margin: 0 0 10px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted-color, #888);
}

.dw-author-card-btn {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--theme-color, #00aa90);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.dw-author-card-btn:hover {
    opacity: .92;
    box-shadow: 0 6px 16px rgba(0, 170, 144, .28);
    transform: translateY(-1px);
}

.dw-author-card-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ---------- 弹框遮罩与面板 ---------- */

html.dwbm-open {
    overflow: hidden;
}

.dwbm-mask {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.dwbm-mask.is-open {
    opacity: 1;
    visibility: visible;
}

.dwbm-modal {
    position: relative;
    width: 640px;
    max-width: 100%;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 26px 28px 22px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
    transform: translateY(10px) scale(.98);
    transition: transform .2s ease;
}

.dwbm-mask.is-open .dwbm-modal {
    transform: translateY(0) scale(1);
}

.dwbm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(128, 128, 128, .12);
    color: inherit;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}

.dwbm-close:hover {
    background: rgba(128, 128, 128, .24);
}

/* ---------- 头部 ---------- */

.dwbm-kicker {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0, 170, 144, .1);
    color: var(--theme-color, #00aa90);
    font-size: 11.5px;
    letter-spacing: .04em;
}

.dwbm-title {
    margin: 10px 0 6px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.dwbm-desc {
    margin: 0 0 4px;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--muted-color, #888);
}

/* ---------- 区块小标题 ---------- */

.dwbm-label {
    margin: 16px 0 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted-color, #888);
}

/* ---------- 样式选择网格 ---------- */

.dwbm-styles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 178px;
    overflow-y: auto;
    padding-right: 2px;
}

.dwbm-style {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid rgba(128, 128, 128, .22);
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.dwbm-style b {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}

.dwbm-style em {
    font-style: normal;
    font-size: 11px;
    line-height: 1.35;
    color: var(--muted-color, #999);
}

.dwbm-style:hover {
    border-color: rgba(0, 170, 144, .55);
}

.dwbm-style.is-active {
    border-color: var(--theme-color, #00aa90);
    background: rgba(0, 170, 144, .07);
    box-shadow: 0 0 0 1px var(--theme-color, #00aa90) inset;
}

/* ---------- 实时预览 ---------- */

.dwbm-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    padding: 18px 14px;
    border: 1px dashed rgba(128, 128, 128, .3);
    border-radius: 12px;
    background:
        repeating-conic-gradient(rgba(128, 128, 128, .07) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
}

.dwbm-preview img {
    display: block;
    height: auto;
}

/* ---------- 代码区 ---------- */

.dwbm-code-tabs {
    display: inline-flex;
    gap: 4px;
    margin: 16px 0 8px;
    padding: 3px;
    border-radius: 10px;
    background: rgba(128, 128, 128, .12);
}

.dwbm-code-tab {
    padding: 5px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.dwbm-code-tab.is-active {
    background: #fff;
    color: var(--theme-color, #00aa90);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

.dwbm-codebox {
    position: relative;
    border-radius: 12px;
    background: #16181d;
    padding: 12px 12px 12px 14px;
}

.dwbm-code {
    display: block;
    width: 100%;
    border: 0;
    padding: 0 96px 0 0;
    background: transparent;
    color: #e8e8e8;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 11.5px;
    line-height: 1.65;
    resize: none;
    outline: none;
    word-break: break-all;
    white-space: pre-wrap;
}

.dwbm-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--theme-color, #00aa90);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: opacity .15s ease;
}

.dwbm-copy:hover {
    opacity: .88;
}

.dwbm-copy.is-done {
    background: #2ca05a;
}

/* ---------- 建议挂载位置 ---------- */

.dwbm-tips {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 170, 144, .06);
    font-size: 12px;
    line-height: 1.8;
}

.dwbm-tips > b {
    color: var(--theme-color, #00aa90);
}

.dwbm-tips ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.dwbm-tips li {
    margin: 2px 0;
    color: var(--muted-color, #777);
}

.dwbm-tips li b {
    color: inherit;
}

/* ---------- 底部 ---------- */

.dwbm-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted-color, #999);
}

.dwbm-foot a {
    color: var(--theme-color, #00aa90);
    text-decoration: none;
    white-space: nowrap;
}

.dwbm-foot a:hover {
    text-decoration: underline;
}

/* ---------- 夜间模式（html.io-black-mode） ---------- */

html.io-black-mode .dwbm-modal {
    background: #1c1e24;
    color: #d6d6d6;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}

html.io-black-mode .dwbm-close {
    background: rgba(255, 255, 255, .1);
    color: #d6d6d6;
}

html.io-black-mode .dwbm-close:hover {
    background: rgba(255, 255, 255, .18);
}

html.io-black-mode .dwbm-style {
    border-color: rgba(255, 255, 255, .16);
}

html.io-black-mode .dwbm-style:hover {
    border-color: rgba(20, 184, 157, .6);
}

html.io-black-mode .dwbm-style.is-active {
    border-color: #14b89d;
    background: rgba(20, 184, 157, .12);
    box-shadow: 0 0 0 1px #14b89d inset;
}

html.io-black-mode .dwbm-code-tabs {
    background: rgba(255, 255, 255, .08);
}

html.io-black-mode .dwbm-code-tab.is-active {
    background: #2a2d36;
    color: #14b89d;
}

html.io-black-mode .dwbm-codebox {
    background: #101216;
}

html.io-black-mode .dwbm-tips {
    background: rgba(20, 184, 157, .08);
}

html.io-black-mode .dwbm-tips li {
    color: #9a9a9a;
}

html.io-black-mode .dwbm-preview {
    border-color: rgba(255, 255, 255, .2);
    background:
        repeating-conic-gradient(rgba(255, 255, 255, .06) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
}
