/* visually-hidden for accessible labels */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Toolbar */
.accessibility-panel {
    --panel-bg: #fff;
    --panel-text: #0b1220;
    --panel-border: rgba(0,0,0,0.1);
    font-family: Inter, sans-serif;
    width: 320px;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    background: var(--panel-bg);
    color: var(--panel-text);
    border: 1px solid var(--panel-border);
    transition: opacity 0.2s, transform 0.2s;
}

.accessibility-panel .controls {
    display: flex;
    flex-direction: column;
    gap: 16px; /* spacing btween groups */
}

.accessibility-panel .controls > div {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px; /* spacing between label and buttons */
}
.accessibility-panel .controls > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.accessibility-panel button,
.accessibility-panel .control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.accessibility-panel button:hover,
.accessibility-panel .control-btn:not([aria-pressed="true"]):hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.accessibility-panel button:focus {
    outline: 3px solid rgba(59,130,246,0.3);
    outline-offset: 2px;
}

.accessibility-panel .control-btn[aria-pressed="true"] {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59,130,246,0.2);
}
.accessibility-panel .control-btn[aria-pressed="true"]:hover {
    background: #2563eb;
}

.accessibility-panel .label {
    font-weight: 700;
    color: #1f2937;
    margin-right: 12px;
    font-size: 0.95rem;
    min-width: 50px;
}

.accessibility-panel .reset-btn {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #4b5563;
}
.accessibility-panel .reset-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.accessibility-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    z-index: 2500;
}

[hidden].accessibility-panel {
    display:none !important;
}

.accessibility-panel .controls > div:nth-child(2) {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 12px;
}

.accessibility-panel .controls > div:nth-child(2) .label {
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 8px;
    margin-right: 0;
}

.accessibility-panel .controls > div:nth-child(2) button,
.accessibility-panel .controls > div:nth-child(2) .control-btn {
    width: auto;
    justify-content: flex-start;
}

html.a11y-high-contrast { background: #000 !important; color: #fff !important; }
html.a11y-high-contrast a { color: #ffff00 !important; }
html.a11y-invert { filter: invert(1) hue-rotate(180deg); }
html.a11y-invert img, html.a11y-invert video { filter: invert(1) hue-rotate(180deg); }
html.a11y-grayscale { filter: grayscale(100%); }
@font-face { font-family: 'OpenDyslexic'; src: local('OpenDyslexic'), local('OpenDyslexic3'); }
html.a11y-dyslexia, html.a11y-dyslexia * { font-family: "OpenDyslexic", "Segoe UI", "Inter", Arial, sans-serif !important; }
html.a11y-font-110 { font-size: 110%; }
html.a11y-font-120 { font-size: 120%; }
html.a11y-font-130 { font-size: 130%; }

@media (max-width:420px){
    .accessibility-panel { width: 90vw; }
}

.dark .accessibility-panel {
    --panel-bg: #1f2937;
    --panel-text: #f3f4f6;
    --panel-border: rgba(255,255,255,0.1);
    background: var(--panel-bg);
    color: var(--panel-text);
    border-color: var(--panel-border);
}
.dark .accessibility-panel .controls > div {
    border-bottom-color: rgba(255,255,255,0.08);
}
.dark .accessibility-panel .controls > div:nth-child(2) .label {
    border-bottom-color: rgba(255,255,255,0.15);
}
.dark .accessibility-panel button,
.dark .accessibility-panel .control-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}
.dark .accessibility-panel button:hover,
.dark .accessibility-panel .control-btn:not([aria-pressed="true"]):hover {
    background: #4b5563;
    border-color: #6b7280;
}
.dark .accessibility-panel .label {
    color: #e5e7eb;
}
.dark .accessibility-panel .reset-btn {
    background: #4b5563;
    border-color: #6b7280;
    color: #e5e7eb;
}
.dark .accessibility-panel .reset-btn:hover {
    background: #6b7280;
}