/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY TOOLBAR — Lynxbe (TI 5568 / WCAG 2.0 AA)
   27 features · Bilingual he/en · Dark/Light theme aware
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Widget namespace isolation --- */
#lxb-a11y-widget {
  position: fixed;
  inset: 0;
  isolation: isolate;
  font-family: var(--font-sans, "Rubik", system-ui, sans-serif);
  z-index: 2147483000 !important;
  pointer-events: none;
}

#lxb-a11y-widget,
#lxb-a11y-widget * {
  box-sizing: border-box;
}

#lxb-a11y-widget .a11y-toolbar-toggle,
#lxb-a11y-widget .a11y-toolbar button,
#lxb-a11y-widget .a11y-page-structure-panel button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* --- Font Scale via zoom (works with px-based sites) --- */
html[data-fontscale="110"] { zoom: 1.1; }
html[data-fontscale="120"] { zoom: 1.2; }
html[data-fontscale="130"] { zoom: 1.3; }
html[data-fontscale="140"] { zoom: 1.4; }
html[data-fontscale="150"] { zoom: 1.5; }
html[data-fontscale="160"] { zoom: 1.6; }
html[data-fontscale="170"] { zoom: 1.7; }
html[data-fontscale="180"] { zoom: 1.8; }
html[data-fontscale="190"] { zoom: 1.9; }
html[data-fontscale="200"] { zoom: 2.0; }

/* Prevent toolbar itself from being zoomed */
.a11y-toolbar,
.a11y-toolbar-toggle,
.a11y-toolbar-overlay,
.a11y-reading-guide-bar,
.a11y-text-magnifier,
.a11y-page-structure-panel {
  zoom: 1 !important;
}

/* --- Toggle Button (FAB) --- */
.a11y-toolbar-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 2147483001 !important;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-orange, #FF5F0B);
  color: #fff;
  border: 2px solid rgba(255, 95, 11, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 95, 11, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
}

.a11y-toolbar-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(255, 95, 11, 0.45);
}

.a11y-toolbar-toggle:focus-visible {
  outline: 2px solid var(--color-orange, #FF5F0B);
  outline-offset: 3px;
}

[dir="rtl"] .a11y-toolbar-toggle {
  left: 20px;
  right: auto;
}

/* --- Panel --- */
.a11y-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483003 !important;
  width: 370px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary, #1A1D24);
  border-right: 1px solid var(--card-border, rgba(255,255,255,0.1));
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s;
}

.a11y-toolbar.active {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

[dir="rtl"] .a11y-toolbar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--card-border, rgba(255,255,255,0.1));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
}

[dir="rtl"] .a11y-toolbar.active {
  transform: translateX(0);
}

/* --- Header --- */
.a11y-toolbar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary, #23262F);
  color: var(--text-primary, #fff);
  flex-shrink: 0;
  border-bottom: 1px solid var(--card-border, rgba(255,255,255,0.1));
}

.a11y-toolbar__header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #fff);
}

.a11y-toolbar__header-title svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.a11y-toolbar__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.a11y-toolbar__header-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: var(--text-primary, #fff);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.a11y-toolbar__header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* --- Scrollable Body --- */
.a11y-toolbar__body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-toolbar__body::-webkit-scrollbar { width: 5px; }
.a11y-toolbar__body::-webkit-scrollbar-track { background: transparent; }
.a11y-toolbar__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* --- Section --- */
.a11y-toolbar__section {
  background: var(--bg-tertiary, #23262F);
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: 10px;
  padding: 12px;
}

.a11y-toolbar__section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary, #9DA0A5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-align: center;
}

/* --- Font Size Control --- */
.a11y-font-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border, rgba(255,255,255,0.1));
}

.a11y-font-control__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #C9CBCF);
  white-space: nowrap;
}

.a11y-font-control__label svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.a11y-font-control__btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
  background: var(--color-orange, #FF5F0B);
  color: #fff;
}

.a11y-font-control__btn:hover {
  filter: brightness(1.15);
  transform: scale(1.1);
}

.a11y-font-control__value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary, #fff);
  min-width: 40px;
  text-align: center;
  background: var(--bg-primary, #090a0c);
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
}

/* --- Feature Grid (3 columns) --- */
.a11y-toolbar__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

/* --- Feature Button --- */
.a11y-toolbar__feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 3px;
  background: var(--bg-secondary, #1A1D24);
  border: 1.5px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-secondary, #C9CBCF);
  text-align: center;
  line-height: 1.25;
  min-height: 72px;
}

.a11y-toolbar__feature svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: var(--text-secondary, #C9CBCF);
  fill: none;
}

.a11y-toolbar__feature:hover {
  border-color: var(--color-orange, #FF5F0B);
  background: rgba(255, 95, 11, 0.06);
}

.a11y-toolbar__feature[aria-pressed="true"] {
  border-color: var(--color-orange, #FF5F0B);
  background: rgba(255, 95, 11, 0.12);
  box-shadow: 0 0 0 1px var(--color-orange, #FF5F0B);
  color: var(--text-primary, #fff);
}

.a11y-toolbar__feature[aria-pressed="true"] svg {
  stroke: var(--color-orange, #FF5F0B);
}

.a11y-toolbar__feature--unsupported {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* --- Footer --- */
.a11y-toolbar__footer {
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--card-border, rgba(255,255,255,0.1));
  text-align: center;
}

.a11y-toolbar__reset {
  width: 100%;
  padding: 9px;
  font-size: 0.75rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-weight: 600;
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary, #9DA0A5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-toolbar__reset:hover {
  background: rgba(220, 50, 50, 0.1);
  border-color: #dc3232;
  color: #dc3232;
}

/* --- Overlay --- */
.a11y-toolbar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2147483002 !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: auto;
}

.a11y-toolbar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

html.light-theme .a11y-toolbar {
  background: #fff;
  border-right-color: rgba(0, 0, 0, 0.1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

html.light-theme[dir="rtl"] .a11y-toolbar {
  border-right-color: transparent;
  border-left-color: rgba(0, 0, 0, 0.1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

html.light-theme .a11y-toolbar__header {
  background: var(--color-grey-98, #F6F6F6);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light-theme .a11y-toolbar__header-title {
  color: var(--color-black, #090a0c);
}

html.light-theme .a11y-toolbar__header-btn {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--color-black, #090a0c);
}

html.light-theme .a11y-toolbar__section {
  background: var(--color-grey-98, #F6F6F6);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light-theme .a11y-toolbar__feature {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--color-grey-20, #303236);
}

html.light-theme .a11y-toolbar__feature svg {
  stroke: var(--color-grey-20, #303236);
}

html.light-theme .a11y-toolbar__feature:hover {
  border-color: var(--color-orange, #FF5F0B);
  background: rgba(255, 95, 11, 0.04);
}

html.light-theme .a11y-toolbar__feature[aria-pressed="true"] {
  border-color: var(--color-orange, #FF5F0B);
  background: rgba(255, 95, 11, 0.08);
  color: var(--color-black, #090a0c);
}

html.light-theme .a11y-toolbar__feature[aria-pressed="true"] svg {
  stroke: var(--color-orange, #FF5F0B);
}

html.light-theme .a11y-font-control__value {
  background: #fff;
  color: var(--color-black, #090a0c);
  border-color: rgba(0, 0, 0, 0.1);
}

html.light-theme .a11y-toolbar__body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY FEATURE CLASSES (applied to <html>)
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Content Adjustments --- */

/* Highlight Titles */
.a11y-highlight-titles h1,
.a11y-highlight-titles h2,
.a11y-highlight-titles h3,
.a11y-highlight-titles h4,
.a11y-highlight-titles h5,
.a11y-highlight-titles h6 {
  outline: 3px solid var(--color-orange, #FF5F0B) !important;
  outline-offset: 4px !important;
  border-radius: 2px;
}

/* Highlight Links */
.a11y-highlight-links a:not(.a11y-toolbar__feature):not(.a11y-toolbar__header-btn):not(.a11y-toolbar-toggle) {
  outline: 2px solid var(--color-blue, #3D7EFF) !important;
  outline-offset: 2px !important;
  text-decoration: underline !important;
}

/* Underline Links (separate from highlight — just underline, no outline) */
.a11y-underline-links a:not(.a11y-toolbar__feature):not(.a11y-toolbar__header-btn):not(.a11y-toolbar-toggle) {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

/* Dyslexia-Friendly Font */
.a11y-dyslexia-font,
.a11y-dyslexia-font * {
  font-family: "Atkinson Hyperlegible", "Lexend", "Comic Sans MS", "Arial", sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.08em !important;
  line-height: 1.75 !important;
  text-rendering: optimizeLegibility !important;
}

/* Readable Font (clean sans-serif) */
.a11y-readable-font,
.a11y-readable-font * {
  font-family: Verdana, Geneva, Arial, 'Helvetica Neue', sans-serif !important;
}

/* Letter Spacing (cycle: off → 1 → 2) */
.a11y-letter-spacing-1 * {
  letter-spacing: 0.1em !important;
  word-spacing: 0.15em !important;
}

.a11y-letter-spacing-2 * {
  letter-spacing: 0.2em !important;
  word-spacing: 0.3em !important;
}

/* Word Spacing (cycle: off → 1 → 2) */
.a11y-word-spacing-1 * {
  word-spacing: 0.2em !important;
}

.a11y-word-spacing-2 * {
  word-spacing: 0.4em !important;
}

/* Line Height (cycle: off → 1 → 2) */
.a11y-line-height-1 * {
  line-height: 2 !important;
}

.a11y-line-height-2 * {
  line-height: 2.5 !important;
}

/* Font Weight */
.a11y-font-weight p,
.a11y-font-weight li,
.a11y-font-weight span,
.a11y-font-weight a,
.a11y-font-weight h1,
.a11y-font-weight h2,
.a11y-font-weight h3,
.a11y-font-weight h4,
.a11y-font-weight h5,
.a11y-font-weight h6,
.a11y-font-weight td,
.a11y-font-weight th,
.a11y-font-weight label,
.a11y-font-weight input,
.a11y-font-weight textarea,
.a11y-font-weight button {
  font-weight: 700 !important;
}

/* Align Left (useful for RTL sites) */
.a11y-align-left p,
.a11y-align-left li,
.a11y-align-left h1,
.a11y-align-left h2,
.a11y-align-left h3,
.a11y-align-left h4,
.a11y-align-left h5,
.a11y-align-left h6,
.a11y-align-left blockquote,
.a11y-align-left td,
.a11y-align-left th,
.a11y-align-left label,
.a11y-align-left input,
.a11y-align-left textarea {
  text-align: left !important;
}

/* --- Color Adjustments --- */

/* Light Contrast */
.a11y-light-contrast {
  --bg-primary: #ffffff !important;
  --bg-secondary: #ffffff !important;
  --bg-tertiary: #f5f5f5 !important;
  --text-primary: #000000 !important;
  --text-secondary: #333333 !important;
  --text-tertiary: #555555 !important;
  --card-bg: #ffffff !important;
  --card-border: rgba(0, 0, 0, 0.2) !important;
}

.a11y-light-contrast body,
.a11y-light-contrast main,
.a11y-light-contrast section,
.a11y-light-contrast article,
.a11y-light-contrast nav,
.a11y-light-contrast aside,
.a11y-light-contrast footer,
.a11y-light-contrast header,
.a11y-light-contrast div,
.a11y-light-contrast p,
.a11y-light-contrast li,
.a11y-light-contrast h1,
.a11y-light-contrast h2,
.a11y-light-contrast h3,
.a11y-light-contrast h4,
.a11y-light-contrast h5,
.a11y-light-contrast h6,
.a11y-light-contrast span,
.a11y-light-contrast strong,
.a11y-light-contrast em,
.a11y-light-contrast label,
.a11y-light-contrast input,
.a11y-light-contrast textarea,
.a11y-light-contrast select,
.a11y-light-contrast button,
.a11y-light-contrast table,
.a11y-light-contrast td,
.a11y-light-contrast th {
  background-color: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0,0,0,0.3) !important;
}

.a11y-light-contrast a {
  color: #0037ff !important;
  text-decoration: underline !important;
}

/* Dark Contrast */
.a11y-dark-contrast body,
.a11y-dark-contrast main,
.a11y-dark-contrast section,
.a11y-dark-contrast article,
.a11y-dark-contrast nav,
.a11y-dark-contrast aside,
.a11y-dark-contrast footer,
.a11y-dark-contrast header,
.a11y-dark-contrast div,
.a11y-dark-contrast p,
.a11y-dark-contrast li,
.a11y-dark-contrast h1,
.a11y-dark-contrast h2,
.a11y-dark-contrast h3,
.a11y-dark-contrast h4,
.a11y-dark-contrast h5,
.a11y-dark-contrast h6,
.a11y-dark-contrast span,
.a11y-dark-contrast strong,
.a11y-dark-contrast em,
.a11y-dark-contrast label,
.a11y-dark-contrast input,
.a11y-dark-contrast textarea,
.a11y-dark-contrast select,
.a11y-dark-contrast button,
.a11y-dark-contrast table,
.a11y-dark-contrast td,
.a11y-dark-contrast th {
  background-color: #121212 !important;
  color: #f2f2f2 !important;
  border-color: rgba(255,255,255,0.28) !important;
}

.a11y-dark-contrast a {
  color: #7cb6ff !important;
  text-decoration: underline !important;
}

/* High Contrast */
.a11y-high-contrast body,
.a11y-high-contrast main,
.a11y-high-contrast section,
.a11y-high-contrast article,
.a11y-high-contrast nav,
.a11y-high-contrast aside,
.a11y-high-contrast footer,
.a11y-high-contrast header,
.a11y-high-contrast div,
.a11y-high-contrast p,
.a11y-high-contrast li,
.a11y-high-contrast h1,
.a11y-high-contrast h2,
.a11y-high-contrast h3,
.a11y-high-contrast h4,
.a11y-high-contrast h5,
.a11y-high-contrast h6,
.a11y-high-contrast span,
.a11y-high-contrast strong,
.a11y-high-contrast em,
.a11y-high-contrast label,
.a11y-high-contrast input,
.a11y-high-contrast textarea,
.a11y-high-contrast select,
.a11y-high-contrast button,
.a11y-high-contrast table,
.a11y-high-contrast td,
.a11y-high-contrast th {
  background-color: #000 !important;
  color: #ff0 !important;
  border-color: #ff0 !important;
}

.a11y-high-contrast a {
  color: #0ff !important;
  text-decoration: underline !important;
}

.a11y-high-contrast img,
.a11y-high-contrast video {
  filter: contrast(1.55) brightness(1.05) !important;
}

/* Monochrome */
.a11y-monochrome {
  filter: grayscale(100%) !important;
}

/* Low Saturation */
.a11y-low-saturation {
  filter: saturate(0.3) !important;
}

/* High Saturation */
.a11y-high-saturation {
  filter: saturate(2.5) !important;
}

/* --- Navigation Adjustments --- */

/* Big Cursor (black) */
.a11y-big-cursor,
.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4L8 40L18 30L28 44L34 40L24 26L38 26Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* White Cursor */
.a11y-white-cursor,
.a11y-white-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4L8 40L18 30L28 44L34 40L24 26L38 26Z' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* Stop Animations */
.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Focus Highlight (enhanced keyboard focus ring) */
.a11y-focus-highlight *:focus,
.a11y-focus-highlight *:focus-visible {
  outline: 3px solid var(--color-orange, #FF5F0B) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(255, 95, 11, 0.3) !important;
}

/* Hide Images */
.a11y-hide-images img:not(.a11y-toolbar img):not(.a11y-toolbar-toggle img),
.a11y-hide-images picture:not(.a11y-toolbar picture),
.a11y-hide-images svg:not(.a11y-toolbar svg):not(.a11y-toolbar-toggle svg):not(.a11y-page-structure-panel svg) {
  opacity: 0.05 !important;
}

.a11y-hide-images [style*="background-image"]:not(.a11y-toolbar *) {
  background-image: none !important;
}

/* Mute Sounds — handled via JS (pauses audio/video) */

/* Reading Guide Bar */
.a11y-reading-guide-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 12px;
  background: rgba(255, 95, 11, 0.3);
  border-top: 2px solid var(--color-orange, #FF5F0B);
  border-bottom: 2px solid var(--color-orange, #FF5F0B);
  pointer-events: none;
  z-index: 2147483004 !important;
  transition: top 0.05s linear;
  display: none;
}

.a11y-reading-guide-bar.active {
  display: block;
}

/* Text Magnifier Tooltip */
.a11y-text-magnifier {
  position: fixed;
  z-index: 2147483005 !important;
  background: var(--bg-tertiary, #23262F);
  color: var(--text-primary, #fff);
  border: 2px solid var(--color-orange, #FF5F0B);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 24px;
  line-height: 1.4;
  max-width: 400px;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none;
  word-break: break-word;
}

.a11y-text-magnifier.active {
  display: block;
}

html.light-theme .a11y-text-magnifier {
  background: #fff;
  color: #000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* Image Alt-text Tooltip Overlay */
.a11y-img-alt-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  line-height: 1.4;
}

.a11y-captions-fallback {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 12px;
  text-align: center;
  padding: 8px 10px;
}

/* Page Structure Navigation Panel */
.a11y-page-structure-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2147483006 !important;
  width: 420px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--bg-secondary, #1A1D24);
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: 12px;
  box-shadow: 0 16px 64px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.a11y-page-structure-panel.active {
  display: flex;
}

.a11y-page-structure-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary, #23262F);
  border-bottom: 1px solid var(--card-border, rgba(255,255,255,0.1));
}

.a11y-page-structure-panel__header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #fff);
  margin: 0;
}

.a11y-page-structure-panel__close {
  background: none;
  border: none;
  color: var(--text-tertiary, #9DA0A5);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px;
  line-height: 1;
}

.a11y-page-structure-panel__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.a11y-page-structure-panel__item {
  display: block;
  width: 100%;
  text-align: start;
  background: none;
  border: none;
  padding: 8px 12px;
  color: var(--text-secondary, #C9CBCF);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.a11y-page-structure-panel__item:hover {
  background: rgba(255, 95, 11, 0.1);
  color: var(--text-primary, #fff);
}

.a11y-page-structure-panel__item[data-level="2"] { padding-left: 24px; }
.a11y-page-structure-panel__item[data-level="3"] { padding-left: 40px; }
.a11y-page-structure-panel__item[data-level="4"] { padding-left: 56px; }
.a11y-page-structure-panel__item[data-level="5"] { padding-left: 72px; }
.a11y-page-structure-panel__item[data-level="6"] { padding-left: 88px; }

[dir="rtl"] .a11y-page-structure-panel__item[data-level="2"] { padding-left: 12px; padding-right: 24px; }
[dir="rtl"] .a11y-page-structure-panel__item[data-level="3"] { padding-left: 12px; padding-right: 40px; }
[dir="rtl"] .a11y-page-structure-panel__item[data-level="4"] { padding-left: 12px; padding-right: 56px; }
[dir="rtl"] .a11y-page-structure-panel__item[data-level="5"] { padding-left: 12px; padding-right: 72px; }
[dir="rtl"] .a11y-page-structure-panel__item[data-level="6"] { padding-left: 12px; padding-right: 88px; }

.a11y-page-structure-panel__tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--color-orange, #FF5F0B);
  margin-inline-end: 6px;
  text-transform: uppercase;
  opacity: 0.7;
}

html.light-theme .a11y-page-structure-panel {
  background: #fff;
  box-shadow: 0 16px 64px rgba(0,0,0,0.15);
}

html.light-theme .a11y-page-structure-panel__header {
  background: var(--color-grey-98, #F6F6F6);
}

html.light-theme .a11y-page-structure-panel__header h3 {
  color: var(--color-black, #090a0c);
}

html.light-theme .a11y-page-structure-panel__item {
  color: var(--color-grey-20, #303236);
}

html.light-theme .a11y-page-structure-panel__item:hover {
  background: rgba(255, 95, 11, 0.06);
  color: var(--color-black, #090a0c);
}

/* Tooltip display — shows title attr on hover */
.a11y-show-tooltips [title]:not(.a11y-toolbar [title])::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary, #23262F);
  color: var(--text-primary, #fff);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.a11y-show-tooltips [title]:not(.a11y-toolbar [title]) {
  position: relative;
}

/* Enlarge Buttons */
.a11y-enlarge-buttons button,
.a11y-enlarge-buttons [role="button"],
.a11y-enlarge-buttons .btn,
.a11y-enlarge-buttons input[type="button"],
.a11y-enlarge-buttons input[type="submit"] {
  min-height: 44px !important;
  min-width: 44px !important;
  padding: 12px 16px !important;
  font-size: 1rem !important;
}

/* Reading Focus */
.a11y-reading-focus .a11y-reading-focus-target {
  background: rgba(255, 95, 11, 0.14) !important;
  outline: 2px solid rgba(255, 95, 11, 0.55) !important;
  border-radius: 6px !important;
}

/* Keyboard Navigation helper */
.a11y-keyboard-nav *:focus-visible {
  outline: 3px solid var(--color-orange, #FF5F0B) !important;
  outline-offset: 3px !important;
}

/* Dictionary popup */
.a11y-dictionary-popup {
  position: fixed;
  z-index: 2147483007 !important;
  max-width: 300px;
  padding: 10px 12px;
  background: var(--bg-tertiary, #23262F);
  color: var(--text-primary, #fff);
  border: 1px solid var(--card-border, rgba(255,255,255,0.18));
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  font-size: 12px;
  line-height: 1.45;
  display: none;
  pointer-events: none;
}

.a11y-dictionary-popup.active {
  display: block;
}

.a11y-smart-nav-overlay {
  position: absolute;
  inset: 0;
  z-index: 2147483007 !important;
  pointer-events: none;
}

.a11y-smart-nav-badge {
  position: absolute;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff5f0b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.a11y-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2147483009 !important;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.a11y-skip-link:focus {
  transform: translateY(0);
}

.a11y-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.a11y-frozen-gif-canvas {
  display: inline-block;
  vertical-align: middle;
}

.a11y-voice-command-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 2147483010 !important;
  display: none;
  gap: 6px;
  flex-wrap: wrap;
  max-width: min(92vw, 360px);
  padding: 8px;
  border-radius: 10px;
  background: rgba(9, 10, 12, 0.95);
  border: 1px solid rgba(255,255,255,0.18);
}

.a11y-voice-command-panel.active {
  display: flex;
}

.a11y-voice-command-panel button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.22);
  background: #1f2430;
  color: #fff;
  font-size: 12px;
}

/* Virtual keyboard */
.a11y-virtual-keyboard {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2147483008 !important;
  background: var(--bg-secondary, #1A1D24);
  border: 1px solid var(--card-border, rgba(255,255,255,0.16));
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  padding: 8px;
  display: none;
  gap: 6px;
  pointer-events: auto;
}

.a11y-virtual-keyboard.active {
  display: grid;
}

.a11y-virtual-keyboard__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.a11y-virtual-keyboard__key {
  min-width: 34px;
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid var(--card-border, rgba(255,255,255,0.15));
  background: var(--bg-tertiary, #23262F);
  color: var(--text-primary, #fff);
  font-size: 12px;
  cursor: pointer;
  padding: 0 8px;
}

html.light-theme .a11y-dictionary-popup {
  background: #fff;
  color: #111;
}

html.light-theme .a11y-virtual-keyboard {
  background: #fff;
}

html.light-theme .a11y-virtual-keyboard__key {
  background: #f4f4f4;
  color: #111;
}

/* --- Mobile Responsive --- */
@media (max-width: 640px) {
  #lxb-a11y-widget .a11y-toolbar {
    width: 100vw;
    max-width: 100vw;
  }

  #lxb-a11y-widget .a11y-toolbar-toggle {
    left: 12px;
    bottom: 12px;
    width: 46px;
    height: 46px;
    font-size: 1.25rem;
  }

  [dir="rtl"] #lxb-a11y-widget .a11y-toolbar-toggle {
    left: 12px;
    right: auto;
  }

  #lxb-a11y-widget .a11y-toolbar__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #lxb-a11y-widget .a11y-toolbar__feature {
    min-height: 70px;
    padding: 8px 4px;
    font-size: 0.625rem;
  }

  #lxb-a11y-widget .a11y-toolbar__feature svg {
    width: 22px;
    height: 22px;
  }

  #lxb-a11y-widget .a11y-page-structure-panel {
    width: 95vw;
    max-height: 80vh;
  }
}

/* Defensive hard isolation against host-page style collisions */
#lxb-a11y-widget .a11y-toolbar,
#lxb-a11y-widget .a11y-toolbar * {
  transform-origin: center;
  max-width: 100%;
}

#lxb-a11y-widget .a11y-toolbar {
  inset: 0 auto 0 0 !important;
}

[dir="rtl"] #lxb-a11y-widget .a11y-toolbar {
  inset: 0 0 0 auto !important;
}

#lxb-a11y-widget .a11y-toolbar__header,
#lxb-a11y-widget .a11y-toolbar__body,
#lxb-a11y-widget .a11y-toolbar__footer {
  position: relative !important;
  float: none !important;
  clear: both !important;
  margin: 0 !important;
}

#lxb-a11y-widget .a11y-toolbar__body {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  gap: 10px !important;
}

#lxb-a11y-widget .a11y-toolbar__section {
  display: block !important;
  position: relative !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 12px !important;
}

#lxb-a11y-widget .a11y-toolbar__grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px !important;
  align-items: stretch !important;
}

#lxb-a11y-widget .a11y-toolbar__feature {
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-break: break-word !important;
}

#lxb-a11y-widget .a11y-toolbar__feature span {
  display: block !important;
  width: 100% !important;
  line-height: 1.25 !important;
}

#lxb-a11y-widget .a11y-toolbar__header-title,
#lxb-a11y-widget .a11y-toolbar__section-title,
#lxb-a11y-widget .a11y-font-control__label,
#lxb-a11y-widget .a11y-font-control__value {
  text-wrap: balance;
  line-height: 1.2 !important;
}
