:root {
    --aa-glass-bg: rgba(18, 18, 18, .72);
    --aa-glass-border: rgba(255, 255, 255, .14);
    --aa-toggle-bg: rgba(18, 18, 18, .72);
    --aa-toggle-border: rgba(255, 255, 255, .14);
    --aa-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    --aa-text: rgba(255, 255, 255, .92);
    --aa-muted: rgba(255, 255, 255, .65);
    --aa-btn-bg: rgba(255, 255, 255, .08);
    --aa-btn-border: rgba(255, 255, 255, .14);
    --aa-btn-hover: rgba(255, 255, 255, .12);
    --aa-pill-bg: rgba(255, 255, 255, .08);
}

@font-face {
    font-family: "OpenDyslexic";
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src:
        url("fonts/opendyslexic/OpenDyslexic-Regular.woff2") format("woff2"),
        url("fonts/opendyslexic/OpenDyslexic-Regular.woff") format("woff");
}

@font-face {
    font-family: "OpenDyslexic";
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src:
        url("fonts/opendyslexic/OpenDyslexic-Bold.woff2") format("woff2"),
        url("fonts/opendyslexic/OpenDyslexic-Bold.woff") format("woff");
}

@font-face {
    font-family: "OpenDyslexic";
    font-style: italic;
    font-display: swap;
    font-weight: 400;
    src:
        url("fonts/opendyslexic/OpenDyslexic-Italic.woff2") format("woff2"),
        url("fonts/opendyslexic/OpenDyslexic-Italic.woff") format("woff");
}

@font-face {
    font-family: "OpenDyslexic";
    font-style: italic;
    font-display: swap;
    font-weight: 700;
    src:
        url("fonts/opendyslexic/OpenDyslexic-Bold-Italic.woff2") format("woff2"),
        url("fonts/opendyslexic/OpenDyslexic-Bold-Italic.woff") format("woff");
}

.aa-readable-font :where(body, body *:not(#aa-accessibility-tool, #aa-accessibility-tool *)) {
    font-family: Arial, Helvetica, sans-serif !important;
}

.aa-open-dyslexic :where(body, body *:not(#aa-accessibility-tool, #aa-accessibility-tool *)) {
    font-family: "OpenDyslexic", Arial, Helvetica, sans-serif !important;
}

.aa-font-size-16 :where(body, body *:not(#aa-accessibility-tool, #aa-accessibility-tool *)) {
    font-size: 16px !important;
}

.aa-high-contrast :where(body, body *:not(#aa-accessibility-tool, #aa-accessibility-tool *)) {
    color: #000 !important;
    background-color: #fff !important;
    border-color: #000 !important;
}

.aa-grayscale body > :not(#aa-accessibility-tool) {
    filter: grayscale(100%);
}

.aa-epilepsy-filter body > :not(#aa-accessibility-tool) {
    filter: saturate(50%) brightness(90%);
}

.aa-grayscale.aa-epilepsy-filter body > :not(#aa-accessibility-tool) {
    filter: grayscale(100%) saturate(50%) brightness(90%);
}

#aa-accessibility-tool {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 2147483000;
    font-family: Arial, Helvetica, sans-serif;
}

#aa-accessibility-toggle {
    width: 56px;
    height: 56px;
    border: 1px solid var(--aa-toggle-border);
    border-radius: 999px;
    background: var(--aa-toggle-bg);
    box-shadow: var(--aa-shadow);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

#aa-accessibility-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 46px rgba(0, 0, 0, .22);
}

#aa-accessibility-toggle img {
    width: 70%;
    height: 70%;
    border-radius: 999px;
    filter: brightness(0) invert(1);
}

#aa-accessibility-popup {
    display: none;
    position: absolute;
    bottom: 68px;
    left: 0;
    width: 280px;
    padding: 14px;
    border: 1px solid var(--aa-glass-border);
    border-radius: 16px;
    background: var(--aa-glass-bg);
    box-shadow: var(--aa-shadow);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

#aa-accessibility-popup.is-open {
    display: block;
}

.aa-header {
    padding: 8px 6px 14px;
}

.aa-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.aa-logo img {
    display: block;
    width: min(100%, 190px);
    max-width: 100%;
    max-height: 80px;
    height: auto;
    object-fit: contain;
}

.aa-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--aa-btn-border);
    border-radius: 12px;
    background: var(--aa-btn-bg);
    color: var(--aa-text);
    cursor: pointer;
    margin: 8px 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    transition: background .15s ease, transform .15s ease, border-color .15s ease;
}

.aa-button:hover {
    background: var(--aa-btn-hover);
    transform: translateY(-1px);
}

.aa-button img {
    width: 20px;
    height: 20px;
    opacity: .85;
    flex: 0 0 auto;
}

.aa-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--aa-btn-border);
    border-radius: 12px;
    background: var(--aa-pill-bg);
    margin: 8px 0;
}

.aa-switch-row span {
    font-size: 12.5px;
    color: var(--aa-text);
    line-height: 1.25;
}

.aa-switch {
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.aa-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.aa-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    transition: .25s ease;
}

.aa-slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    transition: .25s ease;
}

.aa-switch input:checked + .aa-slider {
    background: rgba(255, 255, 255, .35);
}

.aa-switch input:checked + .aa-slider:before {
    transform: translateX(18px);
}

#aa-accessibility-tool :focus-visible {
    outline: 3px solid rgba(255, 255, 255, .35);
    outline-offset: 2px;
}

@media (max-width: 420px) {
    #aa-accessibility-tool {
        left: 12px;
        bottom: 12px;
    }

    #aa-accessibility-popup {
        width: calc(100vw - 24px);
        max-width: 320px;
        padding: 10px 12px;
    }

    .aa-button {
        padding: 8px 10px;
        margin-bottom: 6px;
    }

    .aa-switch-row {
        margin: 4px 0 6px;
    }

}
