.bfc-message-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.bfc-message-overlay::backdrop {
    background: transparent;
}

.bfc-message-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.bfc-message-box {
    width: 400px;
    max-width: 90vw;
    overflow: hidden;
    border: 2px solid #1e3a8a;
    border-radius: 12px;
    background: #eef1f4;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28), 0 0 8px rgba(30, 58, 138, .18);
    transform: translateY(-15px) scale(.95);
    transition: all .25s ease;
}

.bfc-message-overlay.show .bfc-message-box { transform: translateY(0) scale(1); }

.bfc-message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-bottom: 2px solid #79d4ff;
    background: linear-gradient(180deg, #132c68, #07132b);
    color: #fff;
}

.bfc-message-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.bfc-message-icon { width: 28px; height: 28px; flex-shrink: 0; object-fit: contain; user-select: none; }

.bfc-message-close {
    display: flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    transition: all .3s ease;
}

.bfc-message-close:hover { background: rgba(255, 255, 255, .12); color: #79d4ff; }
.bfc-message-body { padding: 24px 28px; }
.bfc-message-text { color: #333; font-size: 15px; line-height: 1.7; white-space: pre-line; word-break: break-word; }

.bfc-message-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid #c7d2e0;
    background: #e7eaee;
}

.bfc-btn {
    position: relative;
    overflow: hidden;
    min-width: 72px;
    height: 34px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: linear-gradient(180deg, #172f68, #081841);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}

.bfc-btn::after {
    content: "";
    position: absolute;
    top: -65%;
    left: -35%;
    width: 45%;
    height: 230%;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, .05) 30%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, .05) 70%, transparent 100%);
    transform: translateX(-180%) rotate(20deg);
    transition: transform .85s cubic-bezier(.22, .61, .36, 1);
}

.bfc-btn:hover::after { transform: translateX(380%) rotate(20deg); }

.bfc-btn:hover {
    transform: none;
    filter: brightness(1.07);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .28), 0 0 8px rgba(121, 212, 255, .95), 0 0 18px rgba(121, 212, 255, .8), 0 0 30px rgba(121, 212, 255, .55);
}

.bfc-btn:active { transform: none; }
.bfc-btn.secondary { border: 2px solid #d9e1e5; background: #fff; color: #1e3a8a; }
.bfc-btn.secondary::after { content: none; }

.clue-toast-container {
    position: fixed;
    z-index: 21000;
    top: 68px;
    right: 20px;
    display: flex;
    width: min(360px, calc(100vw - 32px));
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.clue-toast {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    min-height: 70px;
    box-sizing: border-box;
    overflow: hidden;
    align-items: center;
    gap: 10px;
    padding: 11px 10px 12px 12px;
    border: 2px solid #8fcde9;
    border-radius: 14px;
    background: #eef1f4;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .18), 0 0 0 1px rgba(255, 255, 255, .7) inset, 0 0 18px rgba(52, 214, 255, .12);
    opacity: 0;
    pointer-events: auto;
    transform: translateX(calc(100% + 28px));
    transition: opacity .25s ease, transform .25s ease;
}

.clue-toast.show { opacity: 1; transform: translateX(0); }
.clue-toast.hide { opacity: 0; transform: translateX(calc(100% + 28px)); }
.clue-toast-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #dff5ff; color: #1e3a8a; font-size: 16px; box-shadow: inset 0 0 0 1px rgba(52, 214, 255, .28); }
.clue-toast-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.clue-toast-copy strong { color: #17365f; font-size: 13px; }
.clue-toast-copy span { color: #475569; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.clue-toast-close { display: grid; width: 30px; height: 30px; padding: 0; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #64748b; cursor: pointer; }
.clue-toast-close:hover { background: #eef2f7; color: #1e3a8a; }
.clue-toast-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: linear-gradient(90deg, #1e3a8a, #2563eb 52%, #34d6ff); transform-origin: left; animation: clue-toast-progress linear forwards; }

/* Keep notification outlines consistent across toasts and message dialogs. */
.clue-toast,
.bfc-message-box {
    border-width: 2px;
    border-style: solid;
}

@keyframes clue-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 600px) {
    .clue-toast-container {
        top: max(14px, env(safe-area-inset-top));
        right: 14px;
        width: calc(100vw - 28px);
    }

    .clue-toast { min-height: 64px; }

    .bfc-message-overlay {
        box-sizing: border-box;
        padding: max(16px, env(safe-area-inset-top)) 22px max(16px, env(safe-area-inset-bottom));
        touch-action: manipulation;
    }

    .bfc-message-box {
        width: 100%;
        max-width: 330px;
        border-radius: 14px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, .34), 0 0 16px rgba(30, 58, 138, .20);
    }

    .bfc-message-header {
        min-height: 44px;
        box-sizing: border-box;
        padding: 8px 10px 8px 12px;
    }

    .bfc-message-title {
        min-width: 0;
        gap: 9px;
        font-size: 16px;
    }

    .bfc-message-icon {
        width: 26px;
        height: 26px;
    }

    .bfc-message-close {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        font-size: 19px;
    }

    .bfc-message-body {
        min-height: 76px;
        box-sizing: border-box;
        padding: 18px 16px;
    }

    .bfc-message-text {
        font-size: 15px;
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    .bfc-message-footer {
        padding: 10px 12px 12px;
    }

    .bfc-btn {
        min-width: 96px;
        height: 42px;
        min-height: 42px;
        padding: 0 18px;
        border-radius: 11px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .bfc-message-overlay {
        padding-right: 12px;
        padding-left: 12px;
    }
}

/* Low-glare dialog surfaces shared by authenticated and login pages. Deliberately excludes
   .bfc-message-footer - it shared this exact background with .bfc-message-body above it, so the
   1px border between them was the only thing separating the two and the footer read as if it
   wasn't there at all. Its own background + border-top (further up this file) keeps it visible
   as a distinct bar. */
.bfc-message-box,
.bfc-message-body,
.message-modal-content,
.message-modal-content .modal-body {
    background: #e5eaf0;
}

.bfc-message-box,
.message-modal-content {
    border-color: #294985;
    box-shadow: 0 12px 32px rgba(15, 31, 58, .22);
}
