
.bp-faq {
    --faq-ink: #18273c;
    --faq-muted: #49596d;
    --faq-red: #bc1737;
    --faq-line: #d8dfe7;
    --faq-edge: 20px;
    position: fixed;
    width: max-content;
    max-width: max-content;
    z-index: 900;
    right: max(var(--faq-edge), env(safe-area-inset-right));
    bottom: max(var(--faq-edge), env(safe-area-inset-bottom));
    color: var(--faq-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
}

.bp-faq, .bp-faq *, .bp-faq *::after {
    box-sizing: border-box;
}

.bp-faq[hidden], .bp-faq [hidden] {
    display: none !important;
}

.bp-faq button {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}

.bp-faq .bp-faq__toggle {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--faq-red);
    box-shadow: 0 4px 16px #18273c30;
    color: white;
}

.bp-faq__toggle svg { width: 29px; height: 29px; }

.bp-faq .bp-faq__dialog {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    display: flex;
    flex-direction: column;
    width: 380px;
    height: 540px;
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px - env(safe-area-inset-bottom));
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--faq-line);
    border-radius: 16px;
    background: white;
    box-shadow: 0 12px 40px #18273c29, 0 2px 8px #18273c0d;
}

.bp-faq__header {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 14px 15px 20px;
    background: var(--faq-ink);
    color: white;
}

.bp-faq__header strong, .bp-faq__header span { display: block; }
.bp-faq__header strong { font-size: 20px; line-height: 1.2; }
.bp-faq__header span { margin-top: 3px; font-size: 12px; color: #d4deeb; }

.bp-faq .bp-faq__restart {
    flex: none;
    min-height: 40px;
    margin-left: auto;
    padding: 4px 9px;
    border: 1px solid #ffffff70;
    border-radius: 8px;
    color: white;
}

.bp-faq .bp-faq__close {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff16;
    color: white;
    font: 24px/1 Arial, sans-serif;
}

.bp-faq__body {
    flex: 1;
    min-height: 0;
    padding: 18px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}

.bp-faq__body p { margin: 0; font: inherit; }
.bp-faq__body > p { color: var(--faq-muted); }

.bp-faq__turn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.bp-faq__turn + .bp-faq__turn { margin-top: 20px; }

.bp-faq__turn .bp-faq__question {
    align-self: flex-end;
    max-width: 88%;
    padding: 8px 13px;
    border-radius: 14px 14px 3px 14px;
    background: var(--faq-ink);
    color: #fff;
    font-weight: 600;
    white-space: pre-wrap;
}

.bp-faq__reply {
    max-width: calc(100% - 16px);
    padding: 10px 14px;
    border-radius: 3px 14px 14px;
    background: #f3f5f8;
}

.bp-faq__topics, .bp-faq__feedback, .bp-faq__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.bp-faq__topics:not(:empty), .bp-faq__feedback, .bp-faq__actions { margin-top: 12px; }

.bp-faq .bp-faq__topic, .bp-faq__feedback button {
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid var(--faq-line);
    border-radius: 18px;
    background: #fff;
    color: var(--faq-ink);
    font-size: 13px;
    font-weight: 600;
}

.bp-faq__result {
    margin-top: 16px;
}

.bp-faq__result:empty { display: none; }
.bp-faq__result h3 { margin: 0 0 6px; font-size: 16px; }
.bp-faq__answer { white-space: pre-line; }
.bp-faq__feedback { font-size: 13px; }
.bp-faq__result a, .bp-faq__permanent-contact a { color: #183e65; text-underline-offset: 3px; }
.bp-faq__source { display: inline-block; margin-top: 8px; }

.bp-faq__result ul { list-style: none; margin: 8px 0 0; padding: 0; }
.bp-faq__result li { margin: 0; padding: 0; }
.bp-faq__result li + li { border-top: 1px solid var(--faq-line); }

.bp-faq__result li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 7px 2px;
    font-weight: 600;
    text-decoration: none;
}

.bp-faq__result li a::after {
    content: '';
    flex: none;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border: solid currentColor;
    border-width: 1.5px 1.5px 0 0;
    transform: rotate(45deg);
}

.bp-faq__footer {
    flex: none;
    padding: 14px 20px 12px;
    border-top: 1px solid var(--faq-line);
}

.bp-faq__form { margin: 0; }
.bp-faq__form label { display: block; margin: 0 0 6px; font-weight: 600; }
.bp-faq__input-row { display: flex; align-items: stretch; gap: 8px; }

.bp-faq__input-row textarea {
    flex: 1;
    width: 0;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    margin: 0;
    padding: 10px;
    resize: none;
    border: 1px solid #94a2b1;
    border-radius: 8px;
    background: white;
    box-shadow: none;
    color: var(--faq-ink);
    font: inherit;
}

.bp-faq__input-row button {
    align-self: stretch;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--faq-red);
    color: white;
    font-weight: 700;
}

.bp-faq__input-row button:disabled { opacity: .6; cursor: wait; }

.bp-faq__permanent-contact {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3px 10px;
    margin-top: 8px;
}

.bp-faq__permanent-contact a {
    padding: 3px 0;
    color: var(--faq-muted);
    font-size: 12px;
    text-decoration: underline;
}

@media (hover: hover) {
    .bp-faq .bp-faq__toggle:hover, .bp-faq__input-row button:enabled:hover { background: #97112d; }
    .bp-faq .bp-faq__close:hover, .bp-faq .bp-faq__restart:hover { background: #ffffff30; }
    .bp-faq .bp-faq__topic:hover, .bp-faq__feedback button:hover { border-color: #8a9bae; background: #f3f5f8; }
    .bp-faq__result li a:hover { text-decoration: underline; }
}

.bp-faq :is(button, a, textarea):focus-visible {
    outline: 2px solid #1766ac;
    outline-offset: 2px;
}

.bp-faq .bp-faq__header button:focus-visible { outline-color: white; }
.bp-faq .bp-faq__input-row textarea:focus-visible { border-color: #1766ac; outline-offset: 0; }

@media (max-width: 600px) {
    .bp-faq { --faq-edge: 12px; }
    .bp-faq .bp-faq__dialog {
        width: min(380px, calc(100vw - max(12px, env(safe-area-inset-right)) - max(12px, env(safe-area-inset-left))));
        height: auto;
        max-height: min(520px, calc(100dvh - 92px - env(safe-area-inset-bottom) - env(safe-area-inset-top)));
    }

    .bp-faq__header, .bp-faq__body, .bp-faq__footer { padding-inline: 14px; }
    .bp-faq__input-row textarea { font-size: 16px; }
    .bp-faq__topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bp-faq .bp-faq__topic { min-height: 40px; }
}

@media (max-height: 480px) {
    .bp-faq .bp-faq__dialog {
        position: fixed;
        right: max(8px, env(safe-area-inset-right));
        bottom: max(8px, env(safe-area-inset-bottom));
        max-height: calc(100dvh - 16px - env(safe-area-inset-bottom) - env(safe-area-inset-top));
    }

    .bp-faq__header, .bp-faq__body, .bp-faq__footer { padding-block: 8px; }
}
