/* 左上角磨砂框：线从框右侧先水平向右，再钝角折向右下，指向模型顶端 */
.molecule-caption {
    position: absolute;
    left: 0;
    top: 1.5%;
    z-index: 3;
    width: min(72%, 420px);
    pointer-events: none;
}

/* 英文首页：标注文字 + 引线整体左移约 40px */
html[lang="en"] .molecule-caption {
    left: -40px;
}
html[lang="en"] .mol-anno {
    transform: translateX(-40px) translateZ(0);
}

.molecule-caption-row {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.molecule-caption-box {
    flex: 0 0 auto;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.42);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
    font-family: "Source Han Serif CN", "Noto Serif SC", "Source Han Serif SC", serif;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.molecule-caption-svg {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    min-width: 120px;
    height: 78px;
    margin-top: 8px;
    overflow: visible;
}

.molecule-caption-svg polyline {
    fill: none;
    stroke: #1a1a1a;
    stroke-width: 1.35;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.molecule-caption-svg circle {
    fill: #1a1a1a;
}

@media screen and (max-width: 1100px) {
    .molecule-caption {
        width: min(94%, 480px);
    }
    .molecule-caption-box {
        font-size: 15px;
        padding: 10px 14px;
        white-space: normal;
    }
    .molecule-caption-svg {
        height: 96px;
        min-width: 140px;
    }
}

@media screen and (max-width: 768px) {
    .molecule-caption {
        width: 96%;
        top: 2%;
    }
    .molecule-caption-box {
        font-size: 14px;
        padding: 9px 12px;
    }
    .molecule-caption-svg {
        height: 84px;
        min-width: 120px;
    }
}

/* 分子模型标注：锚点 + 折线 + 英文小字 */
.mol-anno {
    display: block;
    width: 0;
    height: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    position: relative;
    pointer-events: none;
    opacity: 0;
    transform: translateZ(0);
    transition: opacity 0.35s ease;
    --anno-ink: #1a1a1a;
}

.mol-anno.is-on {
    opacity: 1;
}

.mol-anno-dot {
    position: absolute;
    left: -3px;
    top: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--anno-ink);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.mol-anno-leader {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* 折线肘部：先短竖再横出 */
.mol-anno-elbow {
    position: absolute;
    left: 0;
    top: 0;
    width: 34px;
    height: 18px;
    border-color: var(--anno-ink);
    border-style: solid;
    border-width: 0;
    box-sizing: border-box;
    pointer-events: none;
}

.mol-anno-label {
    position: absolute;
    white-space: nowrap;
    font-family: "Source Han Serif CN", "Noto Serif SC", "Source Han Serif SC", serif;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--anno-ink);
    text-shadow:
        0 0 3px rgba(255, 255, 255, 0.95),
        0 0 6px rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

/* 右侧：右上折 */
.mol-anno--right .mol-anno-elbow {
    left: 2px;
    top: -18px;
    border-left-width: 1px;
    border-top-width: 1px;
}
.mol-anno--right .mol-anno-label {
    left: 40px;
    top: -26px;
}

/* 左侧：左上折 */
.mol-anno--left .mol-anno-elbow {
    left: -36px;
    top: -18px;
    border-right-width: 1px;
    border-top-width: 1px;
}
.mol-anno--left .mol-anno-label {
    left: -40px;
    top: -26px;
    transform: translateX(-100%);
    text-align: right;
}

/* 右上 */
.mol-anno--right-up .mol-anno-elbow {
    left: 2px;
    top: -28px;
    height: 28px;
    border-left-width: 1px;
    border-top-width: 1px;
}
.mol-anno--right-up .mol-anno-label {
    left: 40px;
    top: -36px;
}

/* 右下 */
.mol-anno--right-down .mol-anno-elbow {
    left: 2px;
    top: 0;
    height: 22px;
    border-left-width: 1px;
    border-bottom-width: 1px;
}
.mol-anno--right-down .mol-anno-label {
    left: 40px;
    top: 16px;
}

/* 左下 */
.mol-anno--left-down .mol-anno-elbow {
    left: -36px;
    top: 0;
    height: 22px;
    border-right-width: 1px;
    border-bottom-width: 1px;
}
.mol-anno--left-down .mol-anno-label {
    left: -40px;
    top: 16px;
    transform: translateX(-100%);
    text-align: right;
}

@media screen and (max-width: 768px) {
    .mol-anno-label {
        font-size: 10px;
    }
    .mol-anno-elbow {
        width: 26px;
    }
    .mol-anno--right .mol-anno-label,
    .mol-anno--right-up .mol-anno-label,
    .mol-anno--right-down .mol-anno-label {
        left: 32px;
    }
    .mol-anno--left .mol-anno-label,
    .mol-anno--left-down .mol-anno-label {
        left: -32px;
    }
}
