.site-footer {
    background: #0d2f4f;
    color: #cfe1f1;
    padding: 12px 20px;
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    /* The middle column fits its content so Share and Find us can sit on one line; narrower screens go back to equal columns. */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}
.site-footer a { color: inherit; }
.site-footer > div:first-child { text-align: left; }
.site-footer > div:nth-child(2) { text-align: center; }
.site-footer > div:last-child { text-align: right; }
@media (max-width: 1000px) {
    .site-footer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .site-footer { grid-template-columns: 1fr; gap: 6px; }
    .site-footer > div { text-align: left !important; }
}

.back-to-top {
    position: fixed;
    right: 16px;
    bottom: calc(var(--site-footer-height, 65px) + var(--cookie-banner-height, 0px) + 12px);
    z-index: 49;
    padding: 8px 14px;
    border-radius: 999px;
    background: #0d2f4f;
    color: #fff;
    font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.back-to-top:hover, .back-to-top:focus-visible { background: #1a4a78; outline: 2px solid #a9c6de; outline-offset: 2px; }
.back-to-top[hidden] { display: none; }

/* Mobile and short viewports need the whole page available for content.
   Override quiz-specific fixed footers and score-page scroll locks too. */
@media (max-width: 768px), (max-height: 600px), (orientation: portrait) and (hover: none) and (pointer: coarse) {
    html:root body .site-footer { position: static !important; }
    /* Footer is in normal flow here, so the link only clears the cookie banner. */
    html:root body .back-to-top { bottom: calc(var(--cookie-banner-height, 0px) + 16px); }
    html:root body,
    html:root body:has(.result-card) {
        padding-bottom: calc(var(--cookie-banner-height, 0px) + 12px) !important;
        overflow-y: auto !important;
    }
    html:root { overflow-y: auto !important; }
}

.footer-icons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px; margin-top: 6px; }
.footer-share { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.footer-share-label { font-weight: 600; }
.footer-share a, .footer-share button { display: inline-flex; width: 18px; height: 18px; color: inherit; padding: 0; border: 0; background: none; cursor: pointer; }
.footer-share-status { font-size: 12px; font-weight: 600; }
.footer-share-status:empty { display: none; }
.footer-share a:hover, .footer-share a:focus-visible, .footer-share button:hover, .footer-share button:focus-visible { filter: brightness(1.2); outline: none; }
/* Each provider's own brand color (X is white on this dark footer, as in X's reversed logo). Matched by data-brand,
   never by href: a share link carries this site's address inside it. */
.footer-share a[data-brand="linkedin"] { color: #0a66c2; }
.footer-share a[data-brand="facebook"] { color: #1877f2; }
.footer-share a[data-brand="x"] { color: #fff; }
.footer-share a[data-brand="pinterest"] { color: #e60023; }
.footer-share button[data-brand="instagram"] { color: #e4405f; }
.footer-share a[data-brand="blogger"] { color: #f57d00; }
.footer-share a[data-brand="store"] { color: #4caf50; }
.footer-share a[data-brand="amazon"] { color: #ff9900; }
.footer-share a[data-brand="playbooks"] { color: #4285f4; }
.footer-share a[data-brand="spotify"] { color: #1db954; }
.footer-share a[data-brand="youtube"] { color: #f00; }
.footer-share svg { width: 100%; height: 100%; fill: currentColor; }
@media (max-width: 600px) { .footer-icons, .footer-share { justify-content: flex-start; } }
