.ambient_screen {
    overflow: hidden;
    isolation: isolate;
}
.ambient_screen::before {
    content: "";
    position: absolute;
    inset: -18%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 22% 28%, rgba(183, 156, 255, 0.12), transparent 30%),
        radial-gradient(circle at 78% 68%, rgba(79, 209, 197, 0.09), transparent 32%);
    transform: translate3d(-2%, -1%, 0) scale(1.04);
    animation: ambient_veil 11s ease-in-out infinite alternate;
}
.ambient_screen::after {
    content: "";
    position: absolute;
    inset: -30%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        radial-gradient(circle, rgba(255, 245, 210, 0.62) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(201, 184, 255, 0.48) 0 1px, transparent 1.6px);
    background-size:
        72px 72px,
        108px 108px;
    background-position:
        0 0,
        30px 18px;
    animation: ambient_dust 24s linear infinite;
}
.ambient_screen > * {
    position: relative;
    z-index: 1;
}
@keyframes ambient_veil {
    to {
        transform: translate3d(4%, 3%, 0) scale(1.12);
        filter: hue-rotate(8deg);
    }
}
@keyframes ambient_dust {
    to {
        background-position:
            72px 144px,
            -78px 126px;
    }
}

#menu_screen::before {
    background:
        radial-gradient(circle at 50% 23%, rgba(246, 200, 96, 0.18), transparent 27%),
        radial-gradient(circle at 17% 68%, rgba(183, 156, 255, 0.16), transparent 35%),
        radial-gradient(circle at 86% 73%, rgba(79, 209, 197, 0.1), transparent 30%);
}
#menu_screen h1 {
    background-size: 100% 220%;
    animation:
        bounce_in 0.45s cubic-bezier(0.2, 1.2, 0.3, 1) both,
        title_shimmer 5.8s 1s ease-in-out infinite;
}
@keyframes title_shimmer {
    0%,
    68%,
    100% {
        background-position: 50% 0;
    }
    82% {
        background-position: 50% 100%;
        filter: drop-shadow(0 0 0 rgba(246, 200, 96, 0));
    }
    88% {
        filter: drop-shadow(0 0 12px rgba(246, 200, 96, 0.28));
    }
}
.title_mark {
    position: relative;
    animation: bounce_in 0.45s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.title_mark_core {
    display: inline-block;
    animation: title_float 3.6s 0.45s ease-in-out infinite;
}
.title_mark::before,
.title_mark::after {
    content: "✦";
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 8px;
    color: #fff3c8;
    opacity: 0.55;
}
.title_mark::before {
    animation: title_orbit_one 5.6s linear infinite;
}
.title_mark::after {
    animation: title_orbit_two 7.4s linear infinite reverse;
}
@keyframes title_float {
    50% {
        transform: translateY(-4px) rotate(6deg);
        filter: drop-shadow(0 0 17px rgba(246, 200, 96, 0.78));
    }
}
@keyframes title_orbit_one {
    from {
        transform: translate(-50%, -50%) rotate(0deg) translateX(26px) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg) translateX(26px) rotate(-360deg);
    }
}
@keyframes title_orbit_two {
    from {
        transform: translate(-50%, -50%) rotate(35deg) translateX(19px) rotate(-35deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(395deg) translateX(19px) rotate(-395deg);
    }
}
.menu_action {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.menu_action::after {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
    top: -35%;
    bottom: -35%;
    left: -42%;
    width: 24%;
    transform: skewX(-18deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    animation: menu_sheen 6.8s ease-in-out infinite;
}
.menu_action > * {
    position: relative;
    z-index: 1;
}
.menu_action:nth-child(2)::after {
    animation-delay: 1.1s;
}
.menu_action:nth-child(3)::after {
    animation-delay: 2.2s;
}
.menu_action:nth-child(4)::after {
    animation-delay: 3.3s;
}
.menu_action:nth-child(4) {
    animation-delay: 0.3s;
}
#menu_screen .menu_icon {
    animation: menu_icon_float 3.2s ease-in-out infinite;
}
#menu_screen .menu_action:nth-child(2) .menu_icon {
    animation-delay: 0.4s;
}
#menu_screen .menu_action:nth-child(3) .menu_icon {
    animation-delay: 0.8s;
}
#menu_screen .menu_action:nth-child(4) .menu_icon {
    animation-delay: 1.2s;
}
@keyframes menu_sheen {
    0%,
    64% {
        left: -42%;
        opacity: 0;
    }
    70% {
        opacity: 1;
    }
    88%,
    100% {
        left: 122%;
        opacity: 0;
    }
}
@keyframes menu_icon_float {
    50% {
        transform: translateY(-2px) scale(1.035);
        box-shadow: 0 0 14px rgba(246, 200, 96, 0.12);
    }
}

#pause_panel {
    overflow: hidden;
    box-shadow:
        -18px 0 42px rgba(0, 0, 0, 0.36),
        -1px 0 0 rgba(246, 200, 96, 0.08);
}
#pause_panel::before {
    content: "";
    position: absolute;
    inset: -35%;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 25%, rgba(183, 156, 255, 0.14), transparent 30%),
        radial-gradient(circle at 78% 78%, rgba(79, 209, 197, 0.08), transparent 34%);
    animation: pause_glow 8s ease-in-out infinite alternate;
}
#pause_panel > * {
    position: relative;
    z-index: 1;
}
#pause_panel h3 {
    animation: pause_title_pulse 3s ease-in-out infinite;
}
#pause_panel h3::before {
    content: "●";
    display: inline-block;
    margin-right: 7px;
    font-size: 7px;
    color: var(--uti);
    vertical-align: 2px;
    animation: pause_dot 1.8s ease-in-out infinite;
}
@keyframes pause_glow {
    to {
        transform: translate(9%, 5%) scale(1.08);
    }
}
@keyframes pause_title_pulse {
    50% {
        letter-spacing: 2.6px;
        text-shadow: 0 0 12px rgba(246, 200, 96, 0.22);
    }
}
@keyframes pause_dot {
    50% {
        opacity: 0.35;
        transform: scale(0.72);
    }
}

.options_panel {
    width: 100%;
    max-width: 330px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0 14px;
}
.option_group,
.option_toggle {
    width: 100%;
    min-height: 58px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
    padding: 11px 13px;
}
.option_group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    text-align: left;
}
.option_toggle {
    font: inherit;
    color: var(--parchment);
    display: grid;
    grid-template-columns: 1fr auto 28px;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    transition:
        transform 0.12s cubic-bezier(0.3, 1.4, 0.4, 1),
        background 0.12s,
        border-color 0.12s;
}
.option_toggle:hover,
.option_toggle:focus-visible {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(246, 200, 96, 0.42);
    outline: none;
}
.option_label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.45px;
    color: #ffe9b0;
}
.option_state {
    font-size: 9px;
    letter-spacing: 0.8px;
    text-align: right;
    opacity: 0.55;
}
.option_switch {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.11);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition:
        background 0.18s,
        border-color 0.18s,
        box-shadow 0.18s;
}
.option_switch span {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(243, 233, 210, 0.56);
    transition:
        transform 0.22s cubic-bezier(0.2, 1.4, 0.3, 1),
        background 0.18s,
        box-shadow 0.18s;
}
.option_toggle.on .option_switch {
    background: rgba(159, 232, 176, 0.18);
    border-color: rgba(159, 232, 176, 0.55);
    box-shadow: 0 0 12px rgba(159, 232, 176, 0.1);
}
.option_toggle.on .option_switch span {
    transform: translateX(18px);
    background: #9fe8b0;
    box-shadow: 0 0 8px rgba(159, 232, 176, 0.45);
}
.option_toggle.on .option_state {
    color: #9fe8b0;
    opacity: 0.9;
}
.option_countdown {
    width: 100%;
}
#options_back {
    margin-top: 2px;
}
body.screen_flashes_off #fanfare .flash {
    display: none;
}

:where(
    .btn,
    .secondary_btn,
    .mini_btn,
    .boon_toggle,
    .card,
    .pitem,
    #all_boons_btn,
    #pipedex_btn,
    #pause_pipedex_btn,
    .cd_seg button,
    .menu_action,
    .selection_toggle,
    .sort_tabs button,
    .score_row,
    .option_toggle,
    #pause_btn,
    #debug_invincibility_button
) {
    position: relative;
    isolation: isolate;
    transition-duration: 0.16s;
}
:where(
        .btn,
        .secondary_btn,
        .mini_btn,
        .boon_toggle,
        .pitem,
        #all_boons_btn,
        #pipedex_btn,
        #pause_pipedex_btn,
        .cd_seg button,
        .menu_action,
        .selection_toggle,
        .sort_tabs button,
        .score_row,
        .option_toggle,
        #pause_btn,
        #debug_invincibility_button
    ):not(:disabled):is(:hover, :focus-visible) {
    filter: brightness(1.08) saturate(1.05);
}
:where(input[type="text"], input[type="range"]) {
    transition:
        filter 0.16s ease,
        box-shadow 0.16s ease,
        border-color 0.16s ease;
}
:where(input[type="text"], input[type="range"]):hover {
    filter: brightness(1.1) saturate(1.04);
}
.pitem.spent:is(:hover, :focus-visible) {
    filter: saturate(0.55) brightness(1.06);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01s !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }
}
