:root {
    --sa11y-invert: invert(0) hue-rotate(0deg);
    --sa11y-gray: grayscale(0);
    --sa11y-sat: saturate(1);
    --sa11y-contrast: contrast(1);
    --sa11y-bright: brightness(1);
    --sa11y-scale: 1;
    --sa11y-line: normal;
    --sa11y-letter: normal;
}

html.sa11y-invert { --sa11y-invert: invert(1) hue-rotate(180deg); }
html.sa11y-mono { --sa11y-gray: grayscale(1); }
html.sa11y-lowSat { --sa11y-sat: saturate(.45); }
html.sa11y-highSat { --sa11y-sat: saturate(1.65); }
html.sa11y-dark { --sa11y-contrast: contrast(1.35); --sa11y-bright: brightness(.72); }
html.sa11y-light { --sa11y-contrast: contrast(1.16); --sa11y-bright: brightness(1.12); }

html.sa11y-visual body > *:not(.sa11y-root) {
    filter: var(--sa11y-invert) var(--sa11y-gray) var(--sa11y-sat) var(--sa11y-contrast) var(--sa11y-bright) !important;
}

html.sa11y-scaled body > *:not(.sa11y-root) {
    zoom: var(--sa11y-scale);
}

html.sa11y-spacing body > *:not(.sa11y-root) :where(p, li, dd, dt, a, button, label, input, textarea, select, blockquote, figcaption, h1, h2, h3, h4, h5, h6) {
    line-height: var(--sa11y-line) !important;
    letter-spacing: var(--sa11y-letter) !important;
}

html.sa11y-links body a:not(.sa11y-root *) {
    outline: 3px solid #ffb400 !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    text-underline-offset: .18em !important;
}

html.sa11y-headings body :where(h1,h2,h3,h4,h5,h6):not(.sa11y-root *) {
    outline: 3px solid #ffb400 !important;
    outline-offset: 3px !important;
    background-image: linear-gradient(rgba(255,180,0,.16), rgba(255,180,0,.16)) !important;
}

html.sa11y-reader body {
    background: #f5f2e9 !important;
}

html.sa11y-reader body :where(.tm-header, .tm-header-mobile, .tm-toolbar, .uk-navbar-container, nav, footer, aside, .uk-breadcrumb, .uk-slideshow, .uk-slider, .uk-offcanvas, .uk-sticky-placeholder) {
    display: none !important;
}

html.sa11y-reader body :where(main, #tm-main, .tm-main, article, .uk-article) {
    max-width: 860px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

html.sa11y-reader body :where(main, #tm-main, .tm-main, article, .uk-article) p {
    font-family: Georgia, "Times New Roman", serif !important;
    line-height: 1.75 !important;
}

.sa11y-root,
.sa11y-root * {
    box-sizing: border-box;
}

.sa11y-root {
    --sa11y-accent: #1769e0;
    --sa11y-bottom: 24px;
    --sa11y-side: 24px;
    --sa11y-launcher-size: 56px;
    position: fixed;
    z-index: 2147483000;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    filter: none !important;
    zoom: 1 !important;
}

.sa11y-pos-bottom-right,
.sa11y-pos-bottom-left {
    bottom: max(var(--sa11y-bottom), env(safe-area-inset-bottom));
}
.sa11y-pos-bottom-right { right: max(var(--sa11y-side), env(safe-area-inset-right)); }
.sa11y-pos-bottom-left { left: max(var(--sa11y-side), env(safe-area-inset-left)); }

.sa11y-pos-middle-right,
.sa11y-pos-middle-left {
    top: 50%;
    transform: translateY(-50%);
}
.sa11y-pos-middle-right { right: max(var(--sa11y-side), env(safe-area-inset-right)); }
.sa11y-pos-middle-left { left: max(var(--sa11y-side), env(safe-area-inset-left)); }

/* Launcher – gemeinsame Basis */
.sa11y-launcher {
    min-width: var(--sa11y-launcher-size);
    width: auto;
    height: var(--sa11y-launcher-size);
    min-height: var(--sa11y-launcher-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid color-mix(in srgb, #fff 18%, transparent);
    border-radius: 999px;
    padding: 0 17px;
    background: var(--sa11y-accent);
    color: #fff;
    font: inherit;
    font-weight: 750;
    box-shadow: 0 12px 34px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.16);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s ease, box-shadow .18s ease, padding .25s ease, border-radius .25s ease;
}

.sa11y-launcher-icon {
    flex: 0 0 auto;
    width: calc(var(--sa11y-launcher-size) * .54);
    height: calc(var(--sa11y-launcher-size) * .54);
    fill: none;
    stroke: currentColor;
    stroke-width: 2.15;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa11y-launcher-label {
    white-space: nowrap;
    line-height: 1;
}

.sa11y-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 15px 38px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.18);
}

/* SMART: Standard – im Ruhezustand rund, auf Desktop bei Hover/Fokus mit Text. */
.sa11y-style-smart .sa11y-launcher {
    width: var(--sa11y-launcher-size);
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    justify-content: flex-start;
}

.sa11y-style-smart .sa11y-launcher-icon {
    margin-left: calc((var(--sa11y-launcher-size) - (var(--sa11y-launcher-size) * .54)) / 2);
}

.sa11y-style-smart .sa11y-launcher-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateX(-5px);
    transition: max-width .28s ease, opacity .2s ease, transform .28s ease;
}

@media (hover: hover) and (pointer: fine) and (min-width: 641px) {
    .sa11y-style-smart .sa11y-launcher:hover,
    .sa11y-style-smart .sa11y-launcher:focus-visible {
        width: auto;
        padding-right: 18px;
    }

    .sa11y-style-smart .sa11y-launcher:hover .sa11y-launcher-label,
    .sa11y-style-smart .sa11y-launcher:focus-visible .sa11y-launcher-label {
        max-width: 190px;
        opacity: 1;
        transform: translateX(0);
    }
}

/* PILL: Text dauerhaft sichtbar. */
.sa11y-style-pill .sa11y-launcher {
    padding-left: 14px;
    padding-right: 18px;
}

/* CIRCLE: immer nur Symbol. */
.sa11y-style-circle .sa11y-launcher {
    width: var(--sa11y-launcher-size);
    padding: 0;
}
.sa11y-style-circle .sa11y-launcher-label { display: none; }

/* EDGE: kompakte Lasche am Rand. */
.sa11y-style-edge.sa11y-pos-middle-right { right: 0; }
.sa11y-style-edge.sa11y-pos-middle-left { left: 0; }
.sa11y-style-edge.sa11y-pos-bottom-right { right: 0; }
.sa11y-style-edge.sa11y-pos-bottom-left { left: 0; }

.sa11y-style-edge .sa11y-launcher {
    min-width: 0;
    padding: 0 15px;
    gap: 9px;
    box-shadow: 0 10px 28px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.16);
}
.sa11y-style-edge.sa11y-pos-middle-right .sa11y-launcher,
.sa11y-style-edge.sa11y-pos-bottom-right .sa11y-launcher {
    border-radius: 999px 0 0 999px;
    border-right: 0;
}
.sa11y-style-edge.sa11y-pos-middle-left .sa11y-launcher,
.sa11y-style-edge.sa11y-pos-bottom-left .sa11y-launcher {
    border-radius: 0 999px 999px 0;
    border-left: 0;
}

.sa11y-launcher:focus-visible,
.sa11y-panel button:focus-visible,
.sa11y-panel input:focus-visible {
    outline: 3px solid #fff !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px #111 !important;
}

.sa11y-panel {
    position: absolute;
    width: min(460px, calc(100vw - 24px));
    max-height: min(740px, calc(100vh - 24px));
    overflow: auto;
    background: #202124;
    color: #fff;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 24px 70px rgba(0,0,0,.34);
    scrollbar-color: #70747a #202124;
}

.sa11y-pos-bottom-right .sa11y-panel,
.sa11y-pos-bottom-left .sa11y-panel {
    bottom: 0;
}
.sa11y-pos-bottom-right .sa11y-panel { right: 0; }
.sa11y-pos-bottom-left .sa11y-panel { left: 0; }

.sa11y-pos-middle-right .sa11y-panel,
.sa11y-pos-middle-left .sa11y-panel {
    top: 50%;
    transform: translateY(-50%);
}
.sa11y-pos-middle-right .sa11y-panel { right: 0; }
.sa11y-pos-middle-left .sa11y-panel { left: 0; }

.sa11y-style-edge.sa11y-pos-middle-right .sa11y-panel,
.sa11y-style-edge.sa11y-pos-bottom-right .sa11y-panel { right: 12px; }
.sa11y-style-edge.sa11y-pos-middle-left .sa11y-panel,
.sa11y-style-edge.sa11y-pos-bottom-left .sa11y-panel { left: 12px; }

.sa11y-panel[hidden] { display: none !important; }

.sa11y-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 16px;
}

.sa11y-head h2 {
    margin: 0 !important;
    color: #fff !important;
    font: inherit !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: -.02em !important;
}

.sa11y-head-actions { display: flex; align-items: center; gap: 8px; }
.sa11y-icon-btn {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #313236;
    color: #fff;
    cursor: pointer;
}
.sa11y-icon-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sa11y-close { background: var(--sa11y-accent); }

.sa11y-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sa11y-tool {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px;
    padding: 10px 12px;
    background: #303135;
    color: #fff;
    text-align: left;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.sa11y-tool:hover { background: #393a3f; }
.sa11y-tool[aria-pressed="true"] {
    background: color-mix(in srgb, var(--sa11y-accent) 34%, #303135);
    border-color: color-mix(in srgb, var(--sa11y-accent) 75%, #fff);
}

.sa11y-glyph {
    flex: 0 0 32px;
    width: 32px;
    min-height: 32px;
    display: inline-grid;
    place-items: center;
    font-size: 25px;
    line-height: 1;
    color: #fff;
}
.sa11y-glyph-text { font-size: 15px; border: 2px solid currentColor; border-radius: 5px; min-height: 27px; }

.sa11y-adjustments { margin-top: 14px; display: grid; gap: 8px; }
.sa11y-adjust {
    background: #303135;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 10px;
    padding: 10px 12px;
}
.sa11y-adjust-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}
.sa11y-adjust-top output { font-variant-numeric: tabular-nums; }
.sa11y-adjust-controls {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
    gap: 8px;
}
.sa11y-adjust-controls button {
    width: 38px;
    height: 34px;
    border: 0;
    border-radius: 7px;
    background: #3b3c40;
    color: #fff;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.sa11y-adjust-controls input[type="range"] { width: 100%; accent-color: var(--sa11y-accent); }

.sa11y-status {
    min-height: 1.25em;
    margin: 10px 2px 0 !important;
    color: #d4d6da !important;
    font: inherit !important;
    font-size: 12px !important;
}

@media (max-width: 640px) {
    html.sa11y-panel-open,
    html.sa11y-panel-open body {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .sa11y-root {
        --sa11y-bottom: 12px;
        --sa11y-side: 12px;
        top: auto !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        transform: none !important;
    }
    .sa11y-pos-bottom-right,
    .sa11y-pos-middle-right { right: max(12px, env(safe-area-inset-right)); left: auto; }
    .sa11y-pos-bottom-left,
    .sa11y-pos-middle-left { left: max(12px, env(safe-area-inset-left)); right: auto; }

    /*
       Mobile Compact View: bewusst kleiner als die Desktop-Ansicht.
       Das Panel bleibt zentriert, lässt rundherum sichtbar Platz und
       scrollt intern, falls der Inhalt auf einem kleinen Display höher ist.
    */
    .sa11y-panel {
        position: fixed;
        left: 50% !important;
        right: auto !important;
        top: max(14px, env(safe-area-inset-top)) !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
        width: min(360px, calc(100vw - 28px));
        height: auto;
        max-height: calc(88dvh - env(safe-area-inset-top));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        border-radius: 18px;
        padding: 10px;
        box-shadow: 0 18px 50px rgba(0,0,0,.30);
    }

    /* Fallback für ältere Browser ohne dvh-Unterstützung. */
    @supports not (height: 100dvh) {
        .sa11y-panel {
            max-height: 86vh;
        }
    }

    .sa11y-head {
        position: sticky;
        top: -10px;
        z-index: 5;
        margin: -10px 0 8px;
        padding: 9px 0 8px;
        background: #202124;
        border-bottom: 1px solid rgba(255,255,255,.08);
        gap: 8px;
    }

    /* Auf kleinen Bildschirmen bleibt der Auslöser bewusst kompakt. */
    .sa11y-style-smart .sa11y-launcher,
    .sa11y-style-pill .sa11y-launcher,
    .sa11y-style-circle .sa11y-launcher,
    .sa11y-style-edge .sa11y-launcher {
        width: var(--sa11y-launcher-size);
        min-width: var(--sa11y-launcher-size);
        height: var(--sa11y-launcher-size);
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        border: 1px solid color-mix(in srgb, #fff 18%, transparent);
    }
    .sa11y-style-smart .sa11y-launcher-icon { margin-left: 0; }
    .sa11y-launcher-label { display: none !important; }

    /* Kompakte Zwei-Spalten-Kacheln für Smartphones. */
    .sa11y-tools { gap: 5px; }
    .sa11y-tool {
        min-height: 49px;
        gap: 6px;
        padding: 6px 7px;
        font-size: 11.5px;
        line-height: 1.16;
        border-radius: 8px;
    }
    .sa11y-glyph {
        flex-basis: 24px;
        width: 24px;
        min-height: 24px;
        font-size: 18px;
    }
    .sa11y-head h2 {
        font-size: 16px !important;
        line-height: 1.1 !important;
    }
    .sa11y-icon-btn {
        width: 36px;
        height: 36px;
    }

    .sa11y-adjustments { margin-top: 8px; gap: 5px; }
    .sa11y-adjust {
        padding: 6px 8px;
        border-radius: 8px;
    }
    .sa11y-adjust-top {
        margin-bottom: 3px;
        font-size: 11.5px;
    }
    .sa11y-adjust-controls {
        grid-template-columns: 32px 1fr 32px;
        gap: 5px;
    }
    .sa11y-adjust-controls button {
        width: 32px;
        height: 30px;
        font-size: 18px;
    }
    .sa11y-status {
        margin-top: 5px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 340px) {
    .sa11y-panel {
        width: calc(100vw - 18px);
        padding: 8px;
        border-radius: 16px;
        max-height: 90dvh;
    }
    .sa11y-head { top: -8px; margin: -8px 0 7px; padding: 8px 0 7px; }
    .sa11y-head h2 { font-size: 15px !important; }
    .sa11y-tool { min-height: 47px; font-size: 10.8px; padding: 5px 6px; }
    .sa11y-glyph { flex-basis: 22px; width: 22px; min-height: 22px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .sa11y-root *, .sa11y-root *::before, .sa11y-root *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
