.ads-consent,
.ads-consent-fallback {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: #243750;
}

.ads-consent[hidden],
.ads-consent-settings[hidden],
.ads-consent-close[hidden] {
    display: none !important;
}

.measurement-categories[hidden] { display: none !important; }

.ads-consent {
    position: fixed;
    z-index: 20000;
    left: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: min(680px, calc(100vw - 36px));
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #dce7f4;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(21, 44, 76, 0.13);
    box-sizing: border-box;
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
}

.ads-consent h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.ads-consent p {
    margin: 0;
    color: #55677e;
    font-size: 13px;
    line-height: 1.45;
}

.ads-consent-copy { padding-right: 10px; }

.ads-consent a {
    color: #236db6;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ads-consent-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ads-consent-actions button { flex: 1; }
.measurement-categories { display: grid; gap: 14px; padding-top: 15px; border-top: 1px solid #dce7f4; }
.measurement-category { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; position: relative; cursor: pointer; }
.measurement-category input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.measurement-checkbox { width: 20px; height: 20px; border: 1px solid #9fbfe0; border-radius: 6px; background: #f2f7fd; display: grid; place-items: center; margin-top: 1px; }
.measurement-category input:checked + .measurement-checkbox { background: #438dd7; border-color: #438dd7; }
.measurement-category input:checked + .measurement-checkbox::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.measurement-category input:focus-visible + .measurement-checkbox { outline: 3px solid #438dd7; outline-offset: 3px; }
.measurement-category strong { display: block; font-size: 13px; }
.measurement-category small { display: block; font-size: 12px; line-height: 1.5; color: #55677e; margin-top: 2px; }
.measurement-save { border: 1px solid #b9d2ec; border-radius: 10px; padding: 10px 14px; background: #f2f7fd; color: #234b76; font: inherit; font-size: 13px; cursor: pointer; }

.ads-consent-actions button {
    min-width: 92px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #b9d2ec;
    border-radius: 10px;
    background: #f2f7fd;
    color: #234b76;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.ads-consent-actions button:hover {
    background: #e4f0fc;
    border-color: #7aaee0;
}

.ads-consent button:focus-visible,
.ads-consent-settings:focus-visible {
    outline: 3px solid #438dd7;
    outline-offset: 2px;
}

.ads-consent-close {
    position: absolute;
    top: 5px;
    right: 9px;
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    color: #6f7f91;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.ads-consent-settings {
    color: inherit;
    text-decoration: inherit;
}

.ads-consent-settings:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

html[data-theme="dark"] .ads-consent {
    background: #16263b;
    border-color: #344c69;
    color: #e9f2fc;
}

html[data-theme="dark"] .ads-consent p { color: #bfcee0; }
html[data-theme="dark"] .ads-consent a { color: #98cbff; }
html[data-theme="dark"] .ads-consent-actions button {
    background: #203a57;
    border-color: #4b719a;
    color: #e9f2fc;
}
html[data-theme="dark"] .ads-consent-actions button:hover { background: #2b527a; }
html[data-theme="dark"] .ads-consent-close { color: #bfcee0; }
html[data-theme="dark"] .measurement-categories { border-color: #344c69; }
html[data-theme="dark"] .measurement-category small { color: #bfcee0; }
html[data-theme="dark"] .measurement-checkbox,
html[data-theme="dark"] .measurement-save { background: #203a57; border-color: #4b719a; color: #e9f2fc; }
html[data-theme="dark"] .measurement-category input:checked + .measurement-checkbox { background: #438dd7; }

.ads-consent-settings-row {
    margin-top: 12px;
    font-size: 13px;
}

.ads-consent-welcome-link {
    margin-top: 8px;
    text-align: center;
    color: var(--text-light, #55677e);
}

.ads-consent-welcome-link .ads-consent-settings,
.ads-consent-flow-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 32px;
    font-size: 12px;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 3px;
    border-radius: 6px;
}

/* Part of the existing fixed navigation, not an extra page-height footer. */
.bottom-nav-shell.has-consent-settings {
    bottom: calc(44px + env(safe-area-inset-bottom, 0px));
}

.ads-consent-flow-settings {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-light, #55677e);
}

.ads-consent-fallback {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 24px 16px;
    font-size: 13px;
}

.ads-consent-fallback a {
    color: #236db6;
    text-decoration: none;
}

.ads-consent-fallback a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .ads-consent {
        left: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(100vw - 24px);
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 15px 16px;
    }

    .ads-consent-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ads-consent-actions button { width: 100%; min-width: 0; }

}
