.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    margin-bottom: 1rem;
    background: var(--primary-color, #2563eb);
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: #1d4ed8;
}

/* Lives inside the fixed bottom bar, above the help button. */
.ad-banner {
    width: 100%;
    max-width: 600px;
    margin: 0;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px dashed #f59e0b;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    color: #78350f;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

.ad-banner-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    background: #f59e0b;
    color: #ffffff;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.ad-banner-text {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

/* display:flex above beats the [hidden] attribute's default display:none,
   so both slots would otherwise render at once. */
.ad-banner[hidden] {
    display: none;
}

/* The placeholder is a link to the ad manager; the live slot is the
   advertiser's own banner, so it drops the dashed "empty space" look. */
a.ad-banner {
    text-decoration: none;
    cursor: pointer;
}

a.ad-banner-empty:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

.ad-banner-live {
    width: 600px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 600 / 90;
    padding: 0;
    gap: 0;
    border: 0;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.ad-banner-live img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Sits under the live banner so visitors know the slot is open to them.
   Hidden while the placeholder is showing, which already says the same thing. */
.ad-cta {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #92400e;
    text-decoration: none;
    margin-top: 0.35rem;
    opacity: 0.85;
    transition: opacity 0.2s ease, color 0.5s ease;
}

.ad-cta[hidden] {
    display: none;
}

.ad-cta:hover {
    opacity: 1;
    text-decoration: underline;
}

.dark-mode .ad-cta {
    color: #fcd34d;
}

.ad-banner-live .ad-banner-label {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    font-size: 0.45rem;
    line-height: 1;
    padding: 0.08rem 0.2rem;
    border-radius: 0 0 0.2rem 0;
    opacity: 0.75;
}


.dark-mode .ad-banner {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-color: #fbbf24;
    color: #fef3c7;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.dark-mode .ad-banner-label {
    background: #fbbf24;
    color: #78350f;
}

/* Must come after ".dark-mode .ad-banner" - equal specificity, so the
   advertiser's banner only gets its neutral backing by winning on order. */
.dark-mode .ad-banner-live {
    background: transparent;
}

@media (max-width: 768px) {
    .ad-banner {
        padding: 0.625rem 1rem;
        gap: 0.5rem;
    }

    .ad-banner-text {
        font-size: 0.95rem;
    }

    .ad-banner-live {
        padding: 0;
    }

    .ad-cta {
        font-size: 0.75rem;
        margin-top: 0.1rem;
    }
}

/* Shown only when the server confirms the visitor's ISP is not allowed. */
.isp-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #dc2626;
    border-top: 3px solid #991b1b;
    color: #ffffff;
    text-align: center;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
}

/* `display: flex` would otherwise defeat the `hidden` attribute. */
.isp-banner[hidden] {
    display: none;
}

.isp-banner-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
}

.isp-banner strong {
    font-weight: 800;
    text-decoration: underline;
}

/* Keep the fixed banner from covering page content, and lift the bottom bar
   (ad + help button) above it so the two do not sit on top of each other.
   --isp-banner-height is measured in index.html once the banner is shown. */
body.has-isp-banner {
    padding-bottom: calc(var(--bottom-bar-height, 10.5rem)
                         + var(--isp-banner-height, 4.5rem));
}

body.has-isp-banner .bottom-buttons-container {
    bottom: var(--isp-banner-height, 4.5rem);
}

.dark-mode .isp-banner {
    background: #991b1b;
    border-top-color: #f87171;
}

@media (max-width: 768px) {
    .isp-banner {
        padding: 0.875rem 1rem;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    body.has-isp-banner {
        padding-bottom: calc(var(--bottom-bar-height, 11rem)
                             + var(--isp-banner-height, 6rem));
    }
}
