.gmbsl-link {
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    cursor: pointer;
}

button.gmbsl-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.gmbsl-link:focus-visible {
    outline: 3px solid var(--gmbsl-accent, #b58b36);
    outline-offset: 3px;
    border-radius: 2px;
}

.gmbsl-popup {
    position: fixed;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    width: min(var(--gmbsl-popup-width, 560px), calc(100vw - 24px));
    max-height: min(var(--gmbsl-popup-max-height, 440px), calc(100vh - 24px));
    overflow: hidden;
    border: 2px solid var(--gmbsl-border, #b58b36);
    border-radius: 10px;
    background: var(--gmbsl-body-bg, #fffdf7);
    color: var(--gmbsl-body-text, #232323);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28), 0 3px 12px rgba(0, 0, 0, 0.18);
    font-family: inherit;
    line-height: 1.55;
    animation: gmbsl-pop-in 120ms ease-out;
}

.gmbsl-popup[hidden] {
    display: none !important;
}

.gmbsl-popup-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: 48px;
    padding: 8px 10px 8px 14px;
    gap: 12px;
    background: var(--gmbsl-header-bg, #151515);
    color: var(--gmbsl-header-text, #ffffff);
    border-bottom: 3px solid var(--gmbsl-accent, #b58b36);
}

.gmbsl-popup-logo {
    color: var(--gmbsl-accent, #b58b36);
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.gmbsl-popup-reference {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 700;
}

.gmbsl-popup-close {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font: 700 23px/1 Arial, sans-serif;
    cursor: pointer;
}

.gmbsl-popup-close:hover,
.gmbsl-popup-close:focus-visible {
    background: rgba(255, 255, 255, 0.13);
    outline: 2px solid var(--gmbsl-accent, #b58b36);
    outline-offset: 2px;
}

.gmbsl-popup-body {
    min-height: 80px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 20px;
    scrollbar-gutter: stable;
}

.gmbsl-popup-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 14px;
    border-top: 1px solid color-mix(in srgb, var(--gmbsl-border, #b58b36) 42%, transparent);
    background: var(--gmbsl-body-bg, #fffdf7);
    background: color-mix(in srgb, var(--gmbsl-body-bg, #fffdf7) 88%, var(--gmbsl-accent, #b58b36));
    font-size: 0.7rem;
    line-height: 1.35;
}

.gmbsl-popup-footer:empty {
    display: none;
}

.gmbsl-copyright {
    opacity: 0.82;
}

.gmbsl-original-link,
.gmbsl-source-link {
    flex: 0 0 auto;
    color: inherit;
    font-weight: 700;
    white-space: nowrap;
}

.gmbsl-scripture p {
    margin: 0 0 0.82em;
}

.gmbsl-scripture p:last-child {
    margin-bottom: 0;
}

.gmbsl-verse {
    display: grid;
    grid-template-columns: 1.7em 1fr;
    align-items: start;
    gap: 0.15em;
}

.gmbsl-verse-number {
    position: relative;
    top: -0.05em;
    margin-right: 0.28em;
    color: var(--gmbsl-accent, #b58b36);
    color: color-mix(in srgb, var(--gmbsl-accent, #b58b36) 76%, var(--gmbsl-body-text, #232323));
    font-size: 0.68em;
    font-weight: 800;
    line-height: 1;
}

.gmbsl-chapter-divider {
    margin: 1.1em 0 0.8em;
    border-top: 1px solid var(--gmbsl-border, #b58b36);
    padding-top: 0.55em;
    color: var(--gmbsl-accent, #b58b36);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gmbsl-esv-paragraph {
    white-space: pre-wrap;
}

.gmbsl-loading,
.gmbsl-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    text-align: center;
}

.gmbsl-loading {
    gap: 10px;
}

.gmbsl-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid color-mix(in srgb, var(--gmbsl-accent, #b58b36) 30%, transparent);
    border-top-color: var(--gmbsl-accent, #b58b36);
    border-radius: 50%;
    animation: gmbsl-spin 800ms linear infinite;
}

.gmbsl-error {
    color: #8b1e1e;
    font-weight: 650;
}

.gmbsl-image-figure {
    margin: 0;
}

.gmbsl-image-figure img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: calc(var(--gmbsl-popup-max-height, 440px) - 150px);
    margin: 0 auto;
    object-fit: contain;
    border-radius: 5px;
}

.gmbsl-image-figure figcaption {
    margin-top: 10px;
    text-align: center;
    font-size: 0.86rem;
    opacity: 0.8;
}

.gmbsl-custom-content > :first-child {
    margin-top: 0;
}

.gmbsl-custom-content > :last-child {
    margin-bottom: 0;
}

.gmbsl-popup-mobile {
    inset: auto 12px 12px 12px;
    width: auto;
    max-height: min(var(--gmbsl-popup-max-height, 440px), calc(100dvh - 24px));
    border-radius: 12px;
}

@media (max-width: 680px) {
    .gmbsl-popup-header {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding-left: 12px;
    }

    .gmbsl-popup-logo {
        font-size: 0.86rem;
    }

    .gmbsl-popup-reference {
        font-size: 0.8rem;
    }

    .gmbsl-popup-body {
        padding: 16px;
    }

    .gmbsl-popup-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gmbsl-popup,
    .gmbsl-spinner {
        animation: none;
    }
}

@keyframes gmbsl-spin {
    to { transform: rotate(360deg); }
}

@keyframes gmbsl-pop-in {
    from { opacity: 0; transform: translateY(3px) scale(0.992); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
