:root {
    --ffm-purple: #a72b8b;
    --ffm-purple-dark: #571548;
    --ffm-purple-mid: #7c357a;
    --ffm-ink: #24151f;
    --ffm-soft: #f8f2f7;
    --ffm-white: #ffffff;
    --ffm-border: rgba(87, 21, 72, 0.15);
}

.ffm-cookie[hidden],
.ffm-cookie__banner[hidden],
.ffm-cookie__settings[hidden],
.ffm-cookie-footer-link[hidden] {
    display: none !important;
}

.ffm-cookie {
    position: fixed;
    inset: 0;
    z-index: 999999;
    pointer-events: none;
    font-family: inherit;
}

/* The first consent prompt is deliberately non-blocking and compact. */
.ffm-cookie__backdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(32, 12, 28, 0.24);
    backdrop-filter: blur(3px);
    pointer-events: auto;
}

/* Only the detailed settings panel behaves as a modal. */
.ffm-cookie--settings .ffm-cookie__backdrop {
    display: block;
}

.ffm-cookie__banner {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(1180px, calc(100% - 24px));
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.985);
    border: 1px solid var(--ffm-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(54, 12, 45, 0.18);
    pointer-events: auto;
}

.ffm-cookie__icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 20px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--ffm-purple), var(--ffm-purple-dark));
    box-shadow: 0 5px 14px rgba(167, 43, 139, 0.20);
}

.ffm-cookie__copy {
    min-width: 0;
}

.ffm-cookie__copy h2,
.ffm-cookie__settings h2 {
    margin: 0;
    color: var(--ffm-purple-dark);
    font-size: 16px;
    line-height: 1.18;
    font-weight: 800;
}

.ffm-cookie__copy p,
.ffm-cookie__setting-row p {
    margin: 2px 0 0;
    color: #59434f;
    font-size: 12.5px;
    line-height: 1.38;
}

.ffm-cookie__privacy {
    display: inline;
    margin-left: 5px;
    color: var(--ffm-purple-mid);
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.ffm-cookie__actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.ffm-btn {
    min-height: 36px;
    border: 0;
    border-radius: 10px;
    padding: 8px 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.ffm-btn:hover {
    transform: translateY(-1px);
}

.ffm-btn:focus-visible,
.ffm-cookie__close:focus-visible,
.ffm-cookie__settings-close:focus-visible,
.ffm-cookie-footer-link:focus-visible,
.ffm-switch input:focus-visible + .ffm-switch__slider {
    outline: 3px solid rgba(167, 43, 139, 0.30);
    outline-offset: 2px;
}

.ffm-btn--primary {
    color: var(--ffm-white);
    background: linear-gradient(135deg, var(--ffm-purple), var(--ffm-purple-dark));
    box-shadow: 0 5px 13px rgba(167, 43, 139, 0.18);
}

.ffm-btn--secondary {
    color: var(--ffm-purple-dark);
    background: #f2e5ef;
}

.ffm-btn--text {
    min-height: 34px;
    padding: 7px 8px;
    color: var(--ffm-purple-mid);
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ffm-cookie__close,
.ffm-cookie__settings-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--ffm-purple-dark);
    background: #f6edf4;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ffm-cookie__close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
    font-size: 17px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(54, 12, 45, 0.14);
}

/* Detailed settings intentionally stay roomy enough to read. */
.ffm-cookie__settings {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(620px, calc(100% - 32px));
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 24px;
    border-radius: 22px;
    background: var(--ffm-white);
    box-shadow: 0 22px 70px rgba(54, 12, 45, 0.30);
    pointer-events: auto;
}

.ffm-cookie__settings h2 {
    font-size: clamp(20px, 2vw, 25px);
    margin-bottom: 5px;
}

.ffm-cookie__settings-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ffm-border);
}

.ffm-cookie__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--ffm-purple);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
}

.ffm-cookie__setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid var(--ffm-border);
}

.ffm-cookie__setting-row strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ffm-ink);
    font-size: 15px;
}

.ffm-cookie__always {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    color: #29633a;
    background: #e8f6ec;
    font-size: 11px;
    font-weight: 900;
}

.ffm-cookie__setting-row--toggle {
    cursor: pointer;
}

.ffm-switch {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 28px;
}

.ffm-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.ffm-switch__slider {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: #d8ccd5;
    transition: .2s ease;
}

.ffm-switch__slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 4px;
    top: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 7px rgba(0,0,0,.16);
    transition: .2s ease;
}

.ffm-switch input:checked + .ffm-switch__slider {
    background: var(--ffm-purple);
}

.ffm-switch input:checked + .ffm-switch__slider::before {
    transform: translateX(20px);
}

.ffm-cookie__settings-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 18px;
}

.ffm-cookie-footer-link {
    display: block;
    margin: 8px auto 12px;
    padding: 2px 4px;
    border: 0;
    border-radius: 4px;
    color: var(--ffm-purple-mid);
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.ffm-cookie-footer-link:hover {
    color: var(--ffm-purple-dark);
}

@media (max-width: 900px) {
    .ffm-cookie__banner {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 8px 10px;
        padding: 9px 10px;
        bottom: 8px;
        width: calc(100% - 16px);
    }

    .ffm-cookie__icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        font-size: 18px;
        align-self: start;
    }

    .ffm-cookie__copy h2 {
        font-size: 15px;
    }

    .ffm-cookie__copy p {
        font-size: 12px;
        line-height: 1.32;
    }

    .ffm-cookie__privacy {
        font-size: 11px;
    }

    .ffm-cookie__actions {
        grid-column: 1 / -1;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        gap: 6px;
    }

    .ffm-cookie__actions .ffm-btn {
        width: 100%;
    }

    .ffm-cookie__actions .ffm-btn--text {
        width: auto;
    }

    .ffm-cookie__close {
        top: 6px;
        right: 6px;
        background: #f6edf4;
        box-shadow: none;
    }
}

@media (max-width: 520px) {
    .ffm-cookie__banner {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 7px 8px;
        border-radius: 12px;
        max-height: calc(100vh - 12px);
        overflow: auto;
        padding: 8px 9px;
    }

    .ffm-cookie__icon {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: 16px;
    }

    .ffm-cookie__copy h2 {
        padding-right: 22px;
        font-size: 14px;
    }

    .ffm-cookie__copy p {
        margin-top: 1px;
        font-size: 11.5px;
        line-height: 1.3;
    }

    .ffm-cookie__privacy {
        display: inline-block;
        margin: 2px 0 0;
        font-size: 10.5px;
    }

    .ffm-cookie__actions {
        grid-template-columns: 1fr 1fr;
    }

    .ffm-cookie__actions .ffm-btn--text {
        grid-column: 1 / -1;
        justify-self: center;
        min-height: 24px;
        padding: 3px 7px;
    }

    .ffm-btn {
        min-height: 34px;
        padding: 7px 8px;
        font-size: 11px;
    }

    .ffm-cookie__settings {
        width: calc(100% - 20px);
        padding: 18px;
        border-radius: 18px;
    }

    .ffm-cookie__setting-row {
        align-items: flex-start;
        gap: 14px;
    }

    .ffm-cookie__settings-actions {
        flex-direction: column;
    }

    .ffm-cookie__settings-actions .ffm-btn {
        width: 100%;
    }

}

@media (prefers-reduced-motion: reduce) {
    .ffm-btn,
    .ffm-switch__slider,
    .ffm-switch__slider::before {
        transition: none;
    }
}
