.halloween-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(120deg, rgba(0,0,0,0.3) 30%, rgba(235, 97, 35, 0.3) 60%);
    /* Above most theme headers, but below the WordPress admin bar (99999) */
    z-index: 99998;
    /* Let the mouse pass through to the page underneath */
    pointer-events: none;
    user-select: none;
}
/* Start below the WordPress admin bar when a logged-in user sees it */
body.admin-bar .halloween-overlay {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .halloween-overlay {
        top: 46px;
    }
}
/* When closed, hide everything except the link so it can reopen the overlay */
.halloween-overlay.is-hidden {
    background: none;
}
.halloween-overlay.is-hidden > :not(.close-halloween-overlay) {
    display: none;
}
/* Keep the link hidden until the script has restored the saved open/closed state */
.halloween-overlay.is-loading .close-halloween-overlay {
    visibility: hidden;
}
.halloween-overlay a.close-halloween-overlay {
    pointer-events: auto;
    background-color: rgb(235, 97, 35);
    padding: 8px 16px;
    display: inline-block;
    color: white;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.4;
    position: absolute;
    bottom: 64px;
    right: 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.halloween-overlay a.close-halloween-overlay:hover,
.halloween-overlay a.close-halloween-overlay:focus {
    background-color: black;
    color: white;
}
/* Override theme image rules (max-width, margins, borders) that would distort the decorations */
.halloween-overlay img {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}
.halloween-overlay .cobwebs {
    position: absolute;
    top: 0;
    right: 0;
    width: 70%;
    height: auto;
    opacity: 0.5;
}
.halloween-overlay .flying-ghost {
    position: absolute;
    top: 0;
    left: 0;
    width: 10%;
    height: auto;
    opacity: 0.2;
    transform: translate(0, 30vh);
    will-change: transform, opacity;
}
.halloween-overlay .corner-ghosts {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200px;
    max-width: 30%;
    height: auto;
}
.halloween-overlay .jackolanterns {
    position: absolute;
    bottom: 16px;
    left: 50%;
    width: 30%;
    margin-left: -15%;
    display: flex;
    gap: 16px;
}
.halloween-overlay .jackolanterns img {
    flex: 0 0 calc((100% - 32px) / 3);
    width: calc((100% - 32px) / 3);
    height: auto;
    animation: jackolantern-flicker 3s linear infinite;
}
/* Offset each pumpkin so their candles don't flicker in sync */
.halloween-overlay .jackolanterns img:nth-child(2) {
    animation-duration: 2.3s;
    animation-delay: -0.8s;
}
.halloween-overlay .jackolanterns img:nth-child(3) {
    animation-duration: 3.7s;
    animation-delay: -1.9s;
}
/* Irregular glow behind each pumpkin, like a candle lighting it from behind */
@keyframes jackolantern-flicker {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 12px rgba(255, 140, 0, 0.7)) drop-shadow(0 0 28px rgba(255, 90, 0, 0.45)); }
    8%       { filter: brightness(1.08) drop-shadow(0 0 18px rgba(255, 170, 30, 0.85)) drop-shadow(0 0 40px rgba(255, 100, 0, 0.55)); }
    12%      { filter: brightness(0.94) drop-shadow(0 0 8px rgba(255, 120, 0, 0.5)) drop-shadow(0 0 20px rgba(255, 80, 0, 0.3)); }
    20%      { filter: brightness(1.05) drop-shadow(0 0 15px rgba(255, 150, 10, 0.8)) drop-shadow(0 0 34px rgba(255, 95, 0, 0.5)); }
    34%      { filter: brightness(1) drop-shadow(0 0 13px rgba(255, 140, 0, 0.7)) drop-shadow(0 0 30px rgba(255, 90, 0, 0.45)); }
    41%      { filter: brightness(0.9) drop-shadow(0 0 6px rgba(255, 110, 0, 0.45)) drop-shadow(0 0 16px rgba(255, 70, 0, 0.25)); }
    46%      { filter: brightness(1.1) drop-shadow(0 0 20px rgba(255, 180, 40, 0.9)) drop-shadow(0 0 44px rgba(255, 105, 0, 0.6)); }
    58%      { filter: brightness(1.02) drop-shadow(0 0 14px rgba(255, 145, 5, 0.75)) drop-shadow(0 0 32px rgba(255, 92, 0, 0.48)); }
    70%      { filter: brightness(0.96) drop-shadow(0 0 10px rgba(255, 125, 0, 0.6)) drop-shadow(0 0 24px rgba(255, 85, 0, 0.38)); }
    76%      { filter: brightness(1.07) drop-shadow(0 0 17px rgba(255, 165, 25, 0.85)) drop-shadow(0 0 38px rgba(255, 100, 0, 0.55)); }
    88%      { filter: brightness(0.98) drop-shadow(0 0 11px rgba(255, 135, 0, 0.65)) drop-shadow(0 0 26px rgba(255, 88, 0, 0.42)); }
}
@media (prefers-reduced-motion: reduce) {
    .halloween-overlay .jackolanterns img {
        animation: none;
        filter: drop-shadow(0 0 12px rgba(255, 140, 0, 0.7)) drop-shadow(0 0 28px rgba(255, 90, 0, 0.45));
    }
}
@media only screen and (max-width: 720px) {
    .halloween-overlay a.close-halloween-overlay {
        font-size: 14px;
        padding: 4px 8px;
        right: 8px;
        bottom: 128px;
    }
}
