/**
 * wbce_a11y — Accessibility Widget
 * css/widget.css — Panel, Button, a11y-Klassen
 * Kein PHP, kein JS in dieser Datei
 */

/* ── Floating Button ─────────────────────────────── */
#wbce-a11y-btn {
    position: fixed !important;
    bottom: 20px !important;
    z-index: 9998 !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    border-radius: 50% !important;
    border: 2px solid #4a4a8a !important;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.2) !important;
    margin: 0 !important;
    padding: 8px !important;
    transform: none !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: background .2s, color .2s;
}
#wbce-a11y-btn svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}
#wbce-a11y-btn:hover,
#wbce-a11y-btn[aria-expanded="true"] {
    background: #4a4a8a;
    color: #fff;
}
#wbce-a11y-btn.pos-right { right: 20px !important; }
#wbce-a11y-btn.pos-left  { left: 20px !important; }

/* ── Panel ───────────────────────────────────────── */
#wbce-a11y-panel {
    position: fixed !important;
    bottom: 84px !important;
    z-index: 9999 !important;
    width: 300px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 100px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    color: #111 !important;
    background: #fff !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    display: none;
    filter: none !important;
}
/* Theme L (Standard) — explizit damit Override durch andere Themes klar ist */
#wbce-a11y-panel.a11y-panel-l {
    background: #fff !important;
    color: #111 !important;
}
#wbce-a11y-panel.pos-right { right: 20px !important; }
#wbce-a11y-panel.pos-left  { left: 20px !important; }
#wbce-a11y-panel.is-open   { display: block; }

/* ── Alle Kind-Elemente des Panels normalisieren ─── */
#wbce-a11y-panel *,
#wbce-a11y-panel *::before,
#wbce-a11y-panel *::after {
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    background: transparent !important;
    animation: none !important;
    filter: none !important;
    box-sizing: border-box !important;
    transform: none !important;
}

/* ── Panel-Innen ─────────────────────────────────── */
#wbce-a11y-panel .a11y-panel-head {
    padding: .9rem 1rem;
    border-bottom: 2px solid #4a4a8a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #111 !important;
    position: sticky !important;
    top: 0 !important;
    background: #fff !important;
    background-color: #fff !important;
    z-index: 10 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.06);
}
.a11y-panel-section {
    padding: .9rem 1rem;
    border-bottom: 1px solid #ccc;
}
.a11y-panel-section:last-of-type { border-bottom: none; }

.a11y-section-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #555 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}
.a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    gap: 8px;
}
.a11y-row-label {
    font-size: 14px !important;
    color: #111 !important;
    cursor: pointer;
    flex: 1;
}
/* ── Toggle Switch ───────────────────────────── */
.a11y-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.a11y-toggle input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute;
}
.a11y-toggle-track {
    position: absolute;
    inset: 0;
    background: #555;
    border-radius: 24px;
    cursor: pointer;
    border: 2px solid #333;
    filter: none !important;
}
.a11y-toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.5);
    filter: none !important;
    transform: translateX(0);
}
.a11y-toggle input:checked + .a11y-toggle-track {
    background: #4a4a8a !important;
    border-color: #2a2a6a !important;
}
.a11y-toggle input:checked + .a11y-toggle-track::after {
    transform: translateX(20px);
    background: #fff !important;
}
.a11y-toggle input:focus + .a11y-toggle-track {
    outline: 3px solid #f60;
    outline-offset: 2px;
}
/* Toggle filterresistent — checked-Regel muss NACH der Grundfarbe stehen */
#wbce-a11y-panel .a11y-toggle-track {
    filter: none !important;
    background: #555;
    border-color: #222;
}
#wbce-a11y-panel .a11y-toggle-track::after {
    filter: none !important;
    background: #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.6) !important;
}
/* checked: höhere Spezifität durch input-Selektor — steht NACH Grundfarbe */
#wbce-a11y-panel .a11y-toggle input:checked + .a11y-toggle-track {
    background: #4a4a8a !important;
    border-color: #2a2a6a !important;
}
#wbce-a11y-panel .a11y-toggle input:checked + .a11y-toggle-track::after {
    background: #fff !important;
    transform: translateX(20px) !important;
}
/* Schriftgröße-Steuerung */
.a11y-fs-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.a11y-fs-ctrl button {
    width: 34px !important;
    height: 34px !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 6px;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.a11y-fs-ctrl button:hover {
    background: #4a4a8a !important;
    color: #fff !important;
}
.a11y-fs-val {
    min-width: 32px;
    text-align: center;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #111 !important;
}
.a11y-panel-footer {
    padding: .5rem 1rem;
    font-size: 12px !important;
    color: #666 !important;
    border-top: 1px solid #ccc;
}
#wbce-a11y-panel .a11y-reset-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 6px;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}
#wbce-a11y-panel .a11y-reset-btn svg {
    width: 16px !important;
    height: 16px !important;
    stroke: currentColor !important;
}
.a11y-reset-btn:hover {
    background: #4a4a8a !important;
    color: #fff !important;
}

/* ── Mein Profil — jetzt im Panel-Header ── */
#wbce-a11y-panel .a11y-myprofile-btn {
    flex: 0 0 auto;
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 6px;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}
#wbce-a11y-panel .a11y-myprofile-btn svg {
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
}
#wbce-a11y-panel .a11y-myprofile-btn:hover {
    background: #4a4a8a !important;
    color: #fff !important;
}
/* Tooltip — analog TTS-Buttons (css/widget.css Z. ~398) */
#wbce-a11y-panel .a11y-myprofile-btn::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a !important;
    color: #fff !important;
    font-size: 11px !important;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 4px;
    border: 2px solid #888 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    transition-delay: 0ms;
    z-index: 10000;
}
#wbce-a11y-panel .a11y-myprofile-btn:hover::after,
#wbce-a11y-panel .a11y-myprofile-btn:focus-visible::after {
    opacity: 1 !important;
    transition-delay: 100ms;
}
#wbce-a11y-panel .a11y-myprofile-btn:active::after {
    opacity: 0 !important;
    transition-delay: 0ms !important;
}

/* ── a11y-Klassen: NUR auf Content, NICHT auf Widget ─ */

/* Hochkontrast — filter nur auf Body-Kinder, Widget explizit ausgenommen */
body.a11y-hc-invert > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) {
    filter: invert(1) hue-rotate(180deg) !important;
}
/* Bilder in Content re-invertieren */
body.a11y-hc-invert > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) img,
body.a11y-hc-invert > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) video,
body.a11y-hc-invert > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) canvas {
    filter: invert(1) hue-rotate(180deg);
}


/* Hochkontrast — Modus B: custom (via Template-Config oder CSS-Variablen) */
body.a11y-hc-custom {
    background: var(--a11y-hc-bg,  #000) !important;
    color:      var(--a11y-hc-text, #fff) !important;
}
body.a11y-hc-custom > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) {
    background: var(--a11y-hc-bg,  #000) !important;
    color:      var(--a11y-hc-text, #fff) !important;
    border-color: var(--a11y-hc-text, #fff) !important;
}
body.a11y-hc-custom a:not(#wbce-a11y-panel a) {
    color: var(--a11y-hc-link, #ff0) !important;
}
body.a11y-hc-custom button:not(.a11y-reset-btn):not(#wbce-a11y-btn),
body.a11y-hc-custom input:not(#wbce-a11y-panel input),
body.a11y-hc-custom select, body.a11y-hc-custom textarea {
    background: #111 !important;
    color: var(--a11y-hc-text, #fff) !important;
    border-color: var(--a11y-hc-text, #fff) !important;
}

/* Widget selbst: immer sauberer Kontrast, nie invertiert */
#wbce-a11y-panel,
#wbce-a11y-btn {
    filter: none !important;
}

/* Graustufen — Widget explizit ausnehmen via Wrapper */
body.a11y-gs > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) {
    filter: grayscale(1);
}

/* Zeilenabstand — via JS auf Content-Target gesetzt (kein body * mehr) */
[data-a11y-lh] * {
    line-height: 2 !important;
}

/* Animationen stoppen — Widget ausnehmen */
/* ── Animationen stoppen — Eye-Able-Ansatz: reines CSS, kein JS-Timer-Patching ── */
body.a11y-no-anim *:not(#wbce-a11y-panel):not(#wbce-a11y-panel *):not(#wbce-a11y-btn):not(#wbce-a11y-drawer-audio):not(#wbce-a11y-drawer-audio *):not(#wbce-a11y-drawer-color):not(#wbce-a11y-drawer-color *),
body.a11y-no-anim *:not(#wbce-a11y-panel)::before,
body.a11y-no-anim *:not(#wbce-a11y-panel)::after {
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -o-animation: none !important;
    -ms-animation: none !important;
    animation: none !important;
    -moz-animation-fill-mode: forwards !important;
    -ms-animation-fill-mode: forwards !important;
    -o-animation-fill-mode: forwards !important;
    animation-fill-mode: forwards !important;
    -moz-animation-iteration-count: 1 !important;
    -ms-animation-iteration-count: 1 !important;
    -o-animation-iteration-count: 1 !important;
    animation-iteration-count: 1 !important;
    animation-play-state: paused !important;
    -webkit-animation-duration: .01s !important;
    -moz-animation-duration: .01s !important;
    -ms-animation-duration: .01s !important;
    -o-animation-duration: .01s !important;
    animation-duration: .01s !important;
    -o-transition-property: none !important;
    -moz-transition-property: none !important;
    -ms-transition-property: none !important;
    -webkit-transition-property: none !important;
    transition-property: none !important;
    transition: none !important;
    transition-duration: 0.001s !important;
}


/* Fokus verstärken — Widget ausnehmen */
body.a11y-focus *:not(#wbce-a11y-panel):not(#wbce-a11y-panel *):not(#wbce-a11y-btn):focus {
    outline: 4px solid #f60 !important;
    outline-offset: 3px !important;
}

/* Hover-Hervorhebung — eigenständige Komfort-Funktion (kein WCAG-Kriterium),
   verstärkt interaktive Elemente bereits beim Maus-Hover, bevor geklickt/fokussiert wird */
body.a11y-hover a:not(#wbce-a11y-panel a):not(#wbce-a11y-btn):hover,
body.a11y-hover button:not(#wbce-a11y-panel button):not(#wbce-a11y-btn):hover,
body.a11y-hover [onclick]:not(#wbce-a11y-panel):not(#wbce-a11y-btn):hover,
body.a11y-hover input[type="submit"]:hover,
body.a11y-hover input[type="button"]:hover {
    outline: 4px solid #f60 !important;
    outline-offset: 3px !important;
    cursor: pointer;
}

/* Fokus-Ring Widget selbst — immer sichtbar */
#wbce-a11y-btn:focus,
#wbce-a11y-panel button:focus,
#wbce-a11y-panel input:focus {
    outline: 3px solid #f60 !important;
    outline-offset: 2px !important;
}


/* ── TTS-Sektion v1.2 ────────────────────────── */
.a11y-tts-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    position: relative;
}
.a11y-tts-buttons button {
    flex: 1;
    aspect-ratio: 1 !important;
    max-width: 46px !important;
    padding: 8px !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}
.a11y-tts-buttons button svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor !important;
    fill: currentColor !important;
    flex-shrink: 0 !important;
}
.a11y-tts-buttons button:hover:not(:disabled) {
    background: #4a4a8a !important;
    color: #fff !important;
}
.a11y-tts-buttons button:disabled {
    opacity: .4 !important;
    cursor: default !important;
}
/* TTS Tooltip unten — analog Schnelleinstellungen */
#wbce-a11y-panel .a11y-tts-buttons button::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    color: #fff !important;
    font-size: 11px !important;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 4px;
    border: 2px solid #888 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    transition-delay: 0ms;
    z-index: 10000;
}
#wbce-a11y-panel .a11y-tts-buttons button:hover:not(:disabled)::after,
#wbce-a11y-panel .a11y-tts-buttons button:focus-visible::after {
    opacity: 1 !important;
    transition-delay: 100ms;
}
#wbce-a11y-panel .a11y-tts-buttons button:active::after {
    opacity: 0 !important;
    transition-delay: 0ms !important;
}
/* Letzter Button (Stopp): Tooltip nach links damit nicht abgeschnitten */
#wbce-a11y-panel .a11y-tts-buttons button:last-child::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}
.a11y-tts-select {
    width: 100% !important;
    font-size: 12px !important;
    padding: 5px !important;
    margin-bottom: 8px;
    border-radius: 6px !important;
    border: 2px solid #4a4a8a !important;
    background: #fff !important;
    color: #111 !important;
    box-sizing: border-box !important;
}
.a11y-tts-novoice-hint {
    font-size: 11px;
    color: #888;
    margin: -4px 0 8px;
    line-height: 1.4;
}
.a11y-tts-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.a11y-tts-slider-label {
    font-size: 12px !important;
    color: #444 !important;
    min-width: 52px;
}
.a11y-tts-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: #4a4a8a;
}
.a11y-tts-slider-val {
    font-size: 12px !important;
    color: #111 !important;
    min-width: 30px;
    text-align: right;
}
.a11y-tts-unsupported {
    font-size: 12px !important;
    color: #c00 !important;
    display: none;
}

/* ── v1.3: Dark Mode ─────────────────────────── */
html.a11y-dark,
body.a11y-dark {
    background: #1a1a1a !important;
    color: #e8e8e8 !important;
}
body.a11y-dark > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn),
body.a11y-dark > *:not(#wbce-a11y-panel):not(#wbce-a11y-btn) * {
    background-color: #1a1a1a !important;
    color: #e8e8e8 !important;
    border-color: #444 !important;
}
body.a11y-dark a:not(#wbce-a11y-panel a) {
    color: #7ab3ff !important;
}
body.a11y-dark img:not(#wbce-a11y-panel img) {
    opacity: .85;
}

/* ── v1.3: Links unterstreichen ─────────────── */
body.a11y-underline a:not(#wbce-a11y-panel a) {
    text-decoration: underline !important;
}

/* ── v1.3: Buchstabenabstand ─────────────────── */
[data-a11y-lspacing] * {
    letter-spacing: 0.12em !important;
}

/* ── v1.3: Schriftgröße Slider ───────────────── */
.a11y-fs-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 4px;
}
.a11y-fs-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: #4a4a8a;
}
.a11y-fs-slider-val {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #111 !important;
    min-width: 32px;
    text-align: right;
}

/* ── v1.4: OpenDyslexic ──────────────────────── */
/* @font-face wird via JS dynamisch eingefügt (Blob-URL, CORS-sicher) */
/* Maximale Spezifität — überschreibt alle Template-Fonts inkl. !important */
html body.a11y-dyslexic *:not(#wbce-a11y-panel):not(#wbce-a11y-panel *):not(#wbce-a11y-btn) {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* ── v1.4: Bilder ausblenden ─────────────────── */
body.a11y-hideimg img:not(#wbce-a11y-panel img):not(#wbce-a11y-btn img) {
    visibility: hidden !important;
}

/* ── v1.4: Großer Cursor ─────────────────────── */
body.a11y-bigcursor,
body.a11y-bigcursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><polygon points="0,0 0,26 8,20 13,30 17,28 12,18 22,18" fill="black" stroke="white" stroke-width="2"/></svg>') 0 0, auto !important;
}

/* ── v1.4: Lesemaske ─────────────────────────── */
#wbce-a11y-mask {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 9990;
    pointer-events: none;
    display: none;
}
#wbce-a11y-mask.active {
    display: block;
}
#wbce-a11y-mask-top {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    background: rgba(0,0,0,.6);
    z-index: 9990;
    pointer-events: none;
    display: none;
}
#wbce-a11y-mask-bottom {
    position: fixed;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,.6);
    z-index: 9990;
    pointer-events: none;
    display: none;
}
#wbce-a11y-mask-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(255,255,180,.15);
    border-top: 2px solid rgba(255,200,0,.6);
    border-bottom: 2px solid rgba(255,200,0,.6);
    z-index: 9991;
    pointer-events: none;
    display: none;
}
body.a11y-mask #wbce-a11y-mask-top,
body.a11y-mask #wbce-a11y-mask-bottom,
body.a11y-mask #wbce-a11y-mask-line {
    display: block;
}

/* ── Bottom Sheet — Mobil (max-width: 600px) ─── */
@media (max-width: 600px) {

    /* Button: unten rechts auf Mobil */
    #wbce-a11y-btn {
        bottom: 16px !important;
        right: 16px !important;
        left: auto !important;
        transform: none !important;
    }
    #wbce-a11y-btn.pos-left {
        left: 16px !important;
        right: auto !important;
        transform: none !important;
    }

    /* Panel: Bottom Sheet, halbe Bildschirmhöhe */
    #wbce-a11y-panel {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 24px rgba(0,0,0,.18) !important;
        transform: translateY(100%) !important;
        transition: transform .3s ease !important;
        padding-bottom: env(safe-area-inset-bottom, 16px) !important;
    }

    /* Panel offen: einblenden */
    #wbce-a11y-panel.is-open {
        transform: translateY(0) !important;
    }

    /* Drag-Handle oben */
    #wbce-a11y-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 10px auto 6px;
    }

    /* X-Button auf Mobile: oben rechts im Panel-Header, gut erreichbar */
    #wbce-a11y-panel .a11y-panel-head-btns {
        gap: 10px;
    }
    #wbce-a11y-panel .a11y-close-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* Drawers auf Mobile: Layer VOR dem Panel (höherer z-index, von unten über Panel) */
    .a11y-drawer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-height: 50vh !important;
        z-index: 10001 !important; /* über Panel (9999) */
        flex-direction: column !important;
        display: none !important;
        border-radius: 16px 16px 0 0 !important;
        overflow: hidden !important;
        box-shadow: 0 -4px 24px rgba(0,0,0,.25) !important;
    }
    .a11y-drawer.is-panel-open {
        display: none !important; /* auf Mobile nicht automatisch anzeigen */
    }
    /* Drawer-Toggle auf Mobile: eigener Button im Panel */
    .a11y-drawer-toggle {
        display: none !important; /* Desktop-Pfeil verstecken */
    }
    /* Drawer-Content auf Mobile: vollbreite */
    .a11y-drawer-content {
        border: none !important;
        border-radius: 0 !important;
        border-top: 2px solid #4a4a8a !important;
        max-width: 100vw !important;
        max-height: 45vh !important;
        padding: 16px !important;
    }
    .a11y-drawer.is-open {
        display: flex !important;
    }
    .a11y-drawer.is-open .a11y-drawer-content {
        display: block !important;
    }
    /* Drawer-Header auf Mobile */
    .a11y-drawer::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }
}

/* ── v1.5: Profil-Voreinstellungen ──────────── */
.a11y-profiles {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 4px;
}
.a11y-profile-btn {
    width: 100% !important;
    aspect-ratio: 1 !important;
    padding: 8px 4px !important;
    border: 2px solid #ccc !important;
    border-radius: 10px !important;
    background: #f5f5f5 !important;
    color: #444 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all .15s !important;
    position: relative !important;
}
.a11y-profile-btn svg {
    width: 26px !important;
    height: 26px !important;
    stroke: currentColor !important;
    flex-shrink: 0 !important;
}
#wbce-a11y-panel .a11y-profile-btn:hover {
    border-color: #4a4a8a !important;
    background: #eeeef8 !important;
    color: #4a4a8a !important;
}
#wbce-a11y-panel .a11y-profile-btn.active {
    border-color: #4a4a8a !important;
    border-width: 3px !important;
    background: #4a4a8a !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px #c9c9f0;
}
/* Tooltip via CSS — unten */
#wbce-a11y-panel .a11y-profile-btn::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a !important;
    color: #fff !important;
    font-size: 11px !important;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 4px;
    border: 2px solid #888 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    transition-delay: 0ms;
    z-index: 10000;
}
#wbce-a11y-panel .a11y-profile-btn:hover::after,
#wbce-a11y-panel .a11y-profile-btn:focus-visible::after {
    opacity: 1 !important;
    transition-delay: 100ms;
}
/* Nach Klick: Tooltip sofort ausblenden */
#wbce-a11y-panel .a11y-profile-btn:active::after,
#wbce-a11y-panel .a11y-profile-btn.active::after {
    opacity: 0 !important;
    transition-delay: 0ms !important;
}
/* Letztes Icon: Tooltip nach links damit nicht abgeschnitten */
#wbce-a11y-panel .a11y-profile-btn:last-child::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

/* ── v1.6: Audio-Player ──────────────────────── */
.a11y-audio-item {
    margin-bottom: 10px;
}
.a11y-audio-label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 4px;
}
.a11y-audio-player {
    width: 100% !important;
    height: 36px !important;
    border-radius: 6px !important;
    outline: none;
}

/* ── v1.6.x: Visuelles Highlighting beim Vorlesen ── */
.a11y-tts-word-active {
    background: #fff176 !important;
    color: #000 !important;
    border-radius: 2px;
    box-shadow: 0 0 0 2px #fbc02d;
    transition: background .1s ease;
}

/* ── v1.7: Diagnose-Tool (Frontend, nur Admins) ── */
.a11y-diagnose-btn {
    width: 100%;
    padding: 10px;
    background: #4a4a8a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.a11y-diagnose-btn:hover { background: #3a3a72; }
.a11y-diagnose-btn:disabled { opacity: .6; cursor: wait; }
.a11y-diagnose-summary {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    font-size: 13px;
}
.a11y-diagnose-ampel {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 4px 10px;
}
.a11y-diagnose-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
}
.a11y-diagnose-list li {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}
.a11y-diagnose-list li:last-child { border-bottom: none; }

/* ── v1.7.2: X-Schließen-Button im Panel-Header ─────────────── */
.a11y-panel-head-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}
#wbce-a11y-panel .a11y-close-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    color: #4a4a8a !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px;
    flex-shrink: 0;
}
#wbce-a11y-panel .a11y-close-btn:hover {
    background: #f0f0f8 !important;
    color: #4a4a8a !important;
}
#wbce-a11y-panel .a11y-close-btn svg {
    width: 16px !important;
    height: 16px !important;
    stroke: currentColor !important;
}

/* ── v1.7.2: Drawers — links neben dem Panel ────────────────── */
.a11y-drawer {
    position: fixed !important;
    bottom: 84px !important;
    z-index: 9998 !important;
    display: none !important;
    flex-direction: row;
    align-items: stretch;
    filter: none !important;
}
/* Sichtbar wenn Panel offen */
.a11y-drawer.is-panel-open {
    display: flex !important;
}
/* Audio-Drawer: zweite Position, wenn beide gleichzeitig sichtbar */
#wbce-a11y-drawer-color.pos-right  { right: 320px !important; bottom: 84px !important; }
#wbce-a11y-drawer-audio.pos-right  { right: 320px !important; bottom: 180px !important; }
#wbce-a11y-drawer-color.pos-left   { left: 320px !important;  bottom: 84px !important; }
#wbce-a11y-drawer-audio.pos-left   { left: 320px !important;  bottom: 180px !important; }

/* Toggle-Button am Panel-nahen Rand des Drawers */
.a11y-drawer-toggle {
    width: 28px !important;
    min-height: 60px;
    padding: 0 !important;
    border: 2px solid #4a4a8a !important;
    border-radius: 10px 0 0 10px !important;
    background: #fff !important;
    color: #4a4a8a !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}
.a11y-drawer-toggle:hover {
    background: #4a4a8a !important;
    color: #fff !important;
}
.a11y-drawer-toggle svg {
    width: 16px !important;
    height: 16px !important;
    transition: transform .2s;
}
/* Pfeil dreht sich wenn Drawer offen */
.a11y-drawer.is-open .a11y-drawer-toggle svg {
    transform: rotate(180deg);
}

/* Positionierung je nach Panel-Seite */
.a11y-drawer.pos-right { right: 320px !important; }
.a11y-drawer.pos-left  { left: 320px !important; }

.a11y-drawer-content {
    display: none !important;
    background: #fff !important;
    border: 2px solid #4a4a8a !important;
    border-right: none !important;
    border-radius: 10px 0 0 10px !important;
    padding: 12px;
    min-width: 200px;
    max-width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: -4px 4px 16px rgba(0,0,0,.12);
    box-sizing: border-box !important;
}
.a11y-drawer.is-open .a11y-drawer-content {
    display: block !important;
}
.a11y-drawer-placeholder {
    font-size: 13px;
    color: #888;
    text-align: center;
    padding: 16px 8px;
}

/* Mobile: Drawers unter Panel statt seitlich */
@media (max-width: 600px) {
    .a11y-drawer.pos-right,
    .a11y-drawer.pos-left {
        right: 10px !important;
        left: auto !important;
        bottom: auto !important;
        top: 10px !important;
        flex-direction: column;
    }
    .a11y-drawer-toggle {
        border-radius: 10px 10px 0 0 !important;
        min-height: 28px;
        width: 60px !important;
    }
    .a11y-drawer-content {
        border-radius: 0 0 10px 10px !important;
        border-right: 2px solid #4a4a8a !important;
        border-top: none !important;
        max-width: calc(100vw - 20px);
    }
}

/* ── v1.7.5: Farbfilter-Drawer UI ───────────────────────────── */
.a11y-color-filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.a11y-color-btn {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    width: 100% !important;
    padding: 10px 12px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    background: #f8f8f8 !important;
    color: #333 !important;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-align: left !important;
    transition: border-color .15s, background .15s;
}
.a11y-color-btn svg {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
}
.a11y-color-btn:hover {
    border-color: #4a4a8a !important;
    background: #eeeef8 !important;
    color: #4a4a8a !important;
}
.a11y-color-btn[aria-pressed="true"],
.a11y-color-btn.active {
    border-color: #4a4a8a !important;
    background: #4a4a8a !important;
    color: #fff !important;
}
.a11y-color-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 6px 0;
}
.a11y-color-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.a11y-color-slider-row {
    padding: 8px 12px 6px;
    background: #f0f0f8 !important;
    border: 2px solid #4a4a8a !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px !important;
}
.a11y-color-slider-label {
    display: flex !important;
    justify-content: space-between !important;
    font-size: 12px !important;
    color: #444 !important;
    margin-bottom: 4px;
}
.a11y-color-slider-row input[type="range"] {
    width: 100% !important;
    accent-color: #4a4a8a;
}

/* ── Mobile Drawer-Buttons im Panel (nur sichtbar auf Mobile) ── */
.a11y-mobile-drawer-btns {
    display: none; /* Desktop: versteckt */
}
@media (max-width: 600px) {
    .a11y-mobile-drawer-btns {
        display: flex !important;
        gap: 8px;
        padding: 8px 16px;
        border-top: 1px solid #eee;
    }
    .a11y-mobile-drawer-btn {
        flex: 1;
        display: flex !important;
        align-items: center !important;
        gap: 8px;
        padding: 10px 12px !important;
        border: 2px solid #4a4a8a !important;
        border-radius: 8px !important;
        background: #fff !important;
        color: #4a4a8a !important;
        cursor: pointer;
        font-size: 12px !important;
        text-align: left !important;
    }
    .a11y-mobile-drawer-btn svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
        stroke: currentColor !important;
    }
    .a11y-mobile-drawer-btn:hover,
    .a11y-mobile-drawer-btn:active {
        background: #4a4a8a !important;
        color: #fff !important;
    }
}

/* ── Drawer-Schließen-Button (nur Mobile, via JS eingefügt) ── */
@media (max-width: 600px) {
    .a11y-drawer-close {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        width: 100% !important;
        padding: 0 0 12px 0 !important;
        border: none !important;
        background: transparent !important;
        cursor: pointer;
        color: #4a4a8a !important;
    }
    .a11y-drawer-close svg {
        width: 24px !important;
        height: 24px !important;
        stroke: currentColor !important;
    }
}

/* ── Farbfilter-Accordion im Panel ─────────────────────────── */
.a11y-colorfilter-section {
    padding: 0 !important;
}
.a11y-colorfilter-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 12px 16px !important;
    border: none !important;
    background: transparent !important;
    color: #333 !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: left !important;
    border-bottom: 1px solid #eee !important;
}
.a11y-colorfilter-toggle:hover {
    background: #f5f5f5 !important;
    color: #4a4a8a !important;
}
.a11y-accordion-arrow {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
    transition: transform .2s;
}
.a11y-colorfilter-panel {
    padding: 8px 12px 12px !important;
    background: #fafafa !important;
    border-bottom: 1px solid #eee !important;
}

/* ── Accordion-Sektionen (TTS, Audio, Video) ───────────────── */
.a11y-accordion-section {
    padding: 0 !important;
}
.a11y-accordion-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    width: 100% !important;
    padding: 12px 16px !important;
    border: none !important;
    background: transparent !important;
    color: #333 !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: left !important;
    border-bottom: 1px solid #eee !important;
}
.a11y-accordion-toggle:hover {
    background: #f5f5f5 !important;
    color: #4a4a8a !important;
}
.a11y-accordion-toggle svg:first-child {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
}
.a11y-accordion-toggle span {
    flex: 1;
}
.a11y-accordion-content {
    padding: 8px 12px 12px !important;
    background: #fafafa !important;
    border-bottom: 1px solid #eee !important;
}

/* Video-Player responsiv */
.a11y-video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 6px;
    margin-top: 8px;
}
.a11y-video-responsive iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}
.a11y-video-player {
    width: 100% !important;
    border-radius: 6px;
    margin-top: 8px;
}
.a11y-video-item {
    margin-bottom: 12px;
}

/* ── Panel-Erscheinungsbild: L/M/H + Follow-Design ─────────── */
/* M: leicht abgedunkelt */
#wbce-a11y-panel.a11y-panel-m,
#wbce-a11y-btn.a11y-panel-m {
    background: #e8e8f0 !important;
    background-color: #e8e8f0 !important;
}
#wbce-a11y-panel.a11y-panel-m .a11y-panel-head {
    background: #e8e8f0 !important;
    background-color: #e8e8f0 !important;
}
#wbce-a11y-panel.a11y-panel-m .a11y-accordion-toggle,
#wbce-a11y-panel.a11y-panel-m .a11y-colorfilter-toggle {
    background: transparent !important;
}

/* H: dunkel */
#wbce-a11y-panel.a11y-panel-h {
    background: #2a2a3a !important;
    background-color: #2a2a3a !important;
    color: #e8e8e8 !important;
}
#wbce-a11y-panel.a11y-panel-h .a11y-panel-head {
    background: #2a2a3a !important;
    background-color: #2a2a3a !important;
    color: #e8e8e8 !important;
    border-color: #6a6aaa !important;
}
#wbce-a11y-panel.a11y-panel-h .a11y-row-label,
#wbce-a11y-panel.a11y-panel-h .a11y-section-label,
#wbce-a11y-panel.a11y-panel-h .a11y-panel-footer {
    color: #e8e8e8 !important;
}
#wbce-a11y-btn.a11y-panel-h {
    background: #2a2a3a !important;
    color: #e8e8e8 !important;
    border-color: #6a6aaa !important;
}

/* Folgt Dark Mode */
#wbce-a11y-panel.a11y-panel-dark {
    background: #1a1a2a !important;
    background-color: #1a1a2a !important;
    color: #e8e8e8 !important;
}
#wbce-a11y-panel.a11y-panel-dark .a11y-panel-head {
    background: #1a1a2a !important;
    background-color: #1a1a2a !important;
    color: #e8e8e8 !important;
    border-color: #4a4a8a !important;
}
#wbce-a11y-panel.a11y-panel-dark .a11y-row-label,
#wbce-a11y-panel.a11y-panel-dark .a11y-section-label,
#wbce-a11y-panel.a11y-panel-dark .a11y-panel-footer,
#wbce-a11y-panel.a11y-panel-dark .a11y-accordion-toggle,
#wbce-a11y-panel.a11y-panel-dark .a11y-colorfilter-toggle {
    color: #e8e8e8 !important;
    background: transparent !important;
}
#wbce-a11y-btn.a11y-panel-dark {
    background: #1a1a2a !important;
    color: #e8e8e8 !important;
    border-color: #4a4a8a !important;
}

/* Folgt Graustufen */
#wbce-a11y-panel.a11y-panel-gs {
    background: #404040 !important;
    background-color: #404040 !important;
    color: #f0f0f0 !important;
}
#wbce-a11y-panel.a11y-panel-gs .a11y-panel-head {
    background: #404040 !important;
    background-color: #404040 !important;
    color: #f0f0f0 !important;
    border-color: #888 !important;
}
#wbce-a11y-btn.a11y-panel-gs {
    background: #404040 !important;
    color: #f0f0f0 !important;
    border-color: #888 !important;
}

/* ── Kombinierter Seitenzuordnungs-Tab Audio+Video ─────────── */
.a11y-assign-panel {
    padding: 12px 16px;
    background: #f9f9fb;
    border-left: 3px solid #4a4a8a;
    margin: 4px 0 8px 20px;
    border-radius: 0 6px 6px 0;
}
.a11y-assign-panel .a11y-audio-assign-row,
.a11y-assign-panel .a11y-video-assign-row {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}
.a11y-assign-panel .a11y-audio-assign-row:last-of-type,
.a11y-assign-panel .a11y-video-assign-row:last-of-type {
    border-bottom: none;
}

/* ── Click-to-Read ──────────────────────────────────────────── */
body.a11y-ctr-active *:not(#wbce-a11y-panel):not(#wbce-a11y-panel *):not(#wbce-a11y-btn) {
    cursor: text !important;
}
.a11y-ctr-highlight {
    outline: 2px solid #4a4a8a !important;
    outline-offset: 2px !important;
    border-radius: 3px;
    background: rgba(74, 74, 138, 0.08) !important;
    transition: background .15s;
}
