/* Suanming 分享卡 · 内嵌卡片与定制层样式（PC/移动共用） */

/* ---------- 内嵌卡片（每段末尾） ---------- */
.sm-card-block {
    margin: 28px 0 36px;
    padding: 18px 18px 10px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.sm-card-canvas-wrap {
    display: inline-block;
    width: min(320px, 78%);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    background: #fff;
}

.sm-card-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.sm-card-bar {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sm-card-bar button {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #444;
    font-size: 13px;
    line-height: 1;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s;
}

.sm-card-bar button:hover {
    border-color: #8e44ad;
    color: #8e44ad;
}

.sm-card-bar button[data-act="custom"] {
    background: #8e44ad;
    border-color: #8e44ad;
    color: #fff;
}

/* ---------- 定制层 ---------- */
.sm-card-modal {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-card-modal.sm-hidden {
    display: none;
}

.sm-card-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.sm-card-panel {
    position: relative;
    display: flex;
    gap: 24px;
    width: min(760px, 94vw);
    max-height: 92vh;
    padding: 22px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    overflow: auto;
}

.sm-card-preview {
    flex: 0 0 300px;
    align-self: flex-start;
}

.sm-card-preview canvas {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.sm-card-tools {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sm-card-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sm-card-label {
    font-size: 12px;
    color: #999;
    letter-spacing: 1px;
}

.sm-card-skins,
.sm-card-roles,
.sm-card-frames,
.sm-card-align {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sm-chip {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #444;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.sm-chip:hover {
    border-color: #8e44ad;
}

.sm-chip.on {
    background: #8e44ad;
    border-color: #8e44ad;
    color: #fff;
}

.sm-chip-sm {
    font-size: 12px;
    padding: 5px 10px;
}

.sm-skin-chip {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sm-skin-chip span {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.35);
}

.sm-skin-chip.on {
    background: #f0e9f5;
}

.sm-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.sm-card-actions button {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #333;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.sm-card-actions button[data-act="save"] {
    background: #8e44ad;
    border-color: #8e44ad;
    color: #fff;
}

.sm-card-actions .sm-ghost {
    color: #888;
}

.sm-card-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

/* ---------- 悬浮入口与左右切换 ---------- */
.sm-card-fab {
    position: fixed;
    right: 18px;
    bottom: calc(90px + env(safe-area-inset-bottom));
    z-index: 99980;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    background: #8e44ad;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(142, 68, 173, 0.35);
    cursor: pointer;
}

.sm-card-fab b {
    font-weight: 700;
    margin-left: 2px;
}

.sm-card-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 60px;
    border: 0;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    font-size: 24px;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
    z-index: 2;
}

.sm-card-nav:hover {
    background: rgba(0, 0, 0, 0.12);
}

.sm-card-prev {
    left: -6px;
}

.sm-card-next {
    right: -6px;
}

@media (max-width: 640px) {
    .sm-card-nav {
        top: 38%;
        height: 48px;
    }
    .sm-card-prev {
        left: 2px;
    }
    .sm-card-next {
        right: 2px;
    }
}

/* ---------- 提示与大图 ---------- */
.sm-card-toast {
    position: fixed;
    left: 50%;
    bottom: 12vh;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.88);
    color: #fff;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 999px;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.4s;
}

.sm-card-toast.out {
    opacity: 0;
}

.sm-card-bigimg {
    position: fixed;
    inset: 0;
    z-index: 99995;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
}

.sm-card-bigimg img {
    max-width: 92vw;
    max-height: 78vh;
    border-radius: 10px;
}

.sm-card-bigimg p {
    color: #ddd;
    font-size: 14px;
}

body.sm-card-lock {
    overflow: hidden;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
    .sm-card-panel {
        flex-direction: column;
        width: 100vw;
        max-width: 100vw;
        max-height: 88vh;
        margin-top: auto;
        border-radius: 20px 20px 0 0;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    }

    .sm-card-modal {
        align-items: flex-end;
    }

    .sm-card-preview {
        flex: none;
        width: min(260px, 70%);
        margin: 0 auto;
    }

    .sm-card-roles {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .sm-card-block {
        margin: 22px 0 30px;
        padding: 14px 12px 8px;
    }

    .sm-card-canvas-wrap {
        width: min(300px, 84%);
    }
}

/* 打印/导出时不要出现内嵌卡片（PDF 走另一套导出） */
@media print {
    .sm-card-block,
    .sm-card-modal,
    .sm-card-toast,
    .sm-card-bigimg {
        display: none !important;
    }
}

/* ---------- 角标回跳 / 照片微调 / 能力降级 ---------- */
.sm-card-canvas-wrap {
    position: relative;
}

.sm-card-anchor {
    position: absolute;
    left: 4%;
    top: 3%;
    width: 34%;
    height: 12%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.sm-card-anchor:focus-visible {
    outline: 2px solid #8e44ad;
    border-radius: 10px;
}

.sm-card-nudge {
    width: 120px;
    margin-left: 6px;
    vertical-align: middle;
    accent-color: #8e44ad;
}

.sm-card-unsupported {
    margin: 16px 0;
    padding: 10px 14px;
    background: #fff8e6;
    border: 1px solid #f0d9a8;
    border-radius: 8px;
    color: #8a6d3b;
    font-size: 13px;
}

.sm-card-flash {
    animation: smCardFlash 1.2s ease;
}

@keyframes smCardFlash {
    0% { background: rgba(142, 68, 173, 0.16); }
    100% { background: transparent; }
}
