/* ========================================
   ACCESSIBILITY WIDGET v2 - SCORM MODULES
   All classes prefixed a11y- to avoid conflicts
   Added: Highlights & Annotations support
   ======================================== */

/* ========================================
   FONT: OpenDyslexic (bundled)
   ======================================== */

@font-face {
  font-family: 'OpenDyslexic';
  src: url('../fonts/OpenDyslexic-Regular.woff2') format('woff2');
  font-display: swap;
}

/* ========================================
   FLOATING ACTION BUTTON (FAB)
   ======================================== */

.a11y-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1565c0;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.a11y-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  background: #0d47a1;
}

.a11y-fab:focus {
  outline: 3px solid #42a5f5;
  outline-offset: 3px;
}

.a11y-fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.a11y-fab.a11y-fab-active {
  background: #0d47a1;
}

/* ========================================
   PANEL
   ======================================== */

.a11y-panel {
  position: fixed;
  bottom: 86px;
  right: 20px;
  z-index: 9999;
  width: 340px;
  max-height: 70vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.a11y-panel.a11y-panel-open {
  display: flex;
}

/* Panel header */
.a11y-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #1565c0;
  color: white;
  flex-shrink: 0;
}

.a11y-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: white;
}

.a11y-panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.8;
}

.a11y-panel-close:hover {
  opacity: 1;
}

/* Tabs */
.a11y-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  flex-shrink: 0;
  background: #f5f5f5;
}

.a11y-tab {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-align: center;
  transition: color 0.2s ease, background 0.2s ease;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.a11y-tab:hover {
  color: #1565c0;
  background: #e3f2fd;
}

.a11y-tab.a11y-tab-active {
  color: #1565c0;
  border-bottom-color: #1565c0;
  background: white;
}

.a11y-tab svg {
  display: block;
  margin: 0 auto 4px;
  width: 20px;
  height: 20px;
}

/* Tab content */
.a11y-tab-content {
  overflow-y: auto;
  flex: 1;
  padding: 16px;
}

.a11y-tab-pane {
  display: none;
}

.a11y-tab-pane.a11y-tab-pane-active {
  display: block;
}

/* ========================================
   CONTROL GROUPS
   ======================================== */

.a11y-group {
  margin-bottom: 16px;
}

.a11y-group:last-child {
  margin-bottom: 0;
}

.a11y-group-label {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

/* Toggle switch */
.a11y-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.a11y-toggle-row:last-child {
  border-bottom: none;
}

.a11y-toggle-label {
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.a11y-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  margin-left: 10px;
}

.a11y-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.a11y-switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.a11y-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.a11y-switch input:checked + .a11y-switch-slider {
  background: #1565c0;
}

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

.a11y-switch input:focus + .a11y-switch-slider {
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.3);
}

/* Button group (line spacing, font size) */
.a11y-btn-group {
  display: flex;
  gap: 6px;
}

.a11y-btn {
  padding: 6px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
  text-align: center;
}

.a11y-btn:hover {
  border-color: #1565c0;
  color: #1565c0;
  background: #e3f2fd;
}

.a11y-btn.a11y-btn-active {
  background: #1565c0;
  color: white;
  border-color: #1565c0;
}

.a11y-btn.a11y-btn-danger {
  border-color: #e57373;
  color: #c62828;
  background: #ffebee;
}

.a11y-btn.a11y-btn-danger:hover {
  background: #ef5350;
  color: white;
  border-color: #ef5350;
}

/* Font size controls */
.a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-font-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.a11y-font-btn:hover {
  border-color: #1565c0;
  color: #1565c0;
  background: #e3f2fd;
}

.a11y-font-value {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

/* Color overlay swatches */
.a11y-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.a11y-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.a11y-swatch:hover {
  transform: scale(1.15);
}

.a11y-swatch.a11y-swatch-active {
  border-color: #1565c0;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #1565c0;
}

.a11y-swatch-none { background: white; position: relative; }
.a11y-swatch-none::after {
  content: "";
  position: absolute;
  top: 50%; left: 2px; right: 2px;
  height: 2px;
  background: #f44336;
  transform: rotate(-45deg);
}
.a11y-swatch-yellow { background: rgba(255, 255, 0, 0.4); }
.a11y-swatch-blue   { background: rgba(0, 100, 255, 0.25); }
.a11y-swatch-pink   { background: rgba(255, 0, 100, 0.2); }
.a11y-swatch-green  { background: rgba(0, 200, 0, 0.2); }

/* ========================================
   TTS TAB CONTROLS
   ======================================== */

.a11y-tts-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.a11y-tts-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.a11y-tts-btn:hover {
  border-color: #1565c0;
  color: #1565c0;
  background: #e3f2fd;
}

.a11y-tts-btn.a11y-tts-playing {
  background: #1565c0;
  color: white;
  border-color: #1565c0;
}

.a11y-tts-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.a11y-tts-speed {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.a11y-tts-speed label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  flex-shrink: 0;
}

.a11y-tts-speed input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

.a11y-tts-speed input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1565c0;
  cursor: pointer;
}

.a11y-tts-speed-val {
  font-size: 12px;
  font-weight: 700;
  color: #1565c0;
  min-width: 32px;
  text-align: right;
}

.a11y-tts-voice {
  margin-bottom: 10px;
}

.a11y-tts-voice label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.a11y-tts-voice select {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  background: white;
  cursor: pointer;
}

.a11y-tts-voice select:focus {
  border-color: #1565c0;
  outline: none;
}

.a11y-tts-status {
  font-size: 12px;
  color: #888;
  text-align: center;
  padding: 4px 0;
  min-height: 22px;
}

/* ========================================
   TRANSLATE TAB
   ======================================== */

.a11y-translate-select {
  margin-bottom: 12px;
}

.a11y-translate-select label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.a11y-translate-select select {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  background: white;
  cursor: pointer;
}

.a11y-translate-select select:focus {
  border-color: #1565c0;
  outline: none;
}

.a11y-translate-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.a11y-translate-actions .a11y-btn {
  flex: 1;
}

.a11y-translate-note {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
  padding: 8px 10px;
  background: #f9f9f9;
  border-radius: 6px;
}

.a11y-translate-fallback {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  padding: 12px;
  background: #fff3e0;
  border-radius: 6px;
  border-left: 3px solid #ff9800;
}

/* ========================================
   TTS HIGHLIGHT (on content)
   ======================================== */

.a11y-tts-highlight {
  background: rgba(255, 235, 59, 0.35) !important;
  border-radius: 4px;
  outline: 2px solid rgba(255, 193, 7, 0.5);
  outline-offset: 2px;
  transition: background 0.2s ease;
}

[data-a11y-tabbable]:focus-visible {
  outline: 2px solid #1565c0;
  outline-offset: 3px;
  border-radius: 3px;
}

[data-a11y-tabbable]:focus-visible:not(.a11y-tts-highlight) {
  background: rgba(21, 101, 192, 0.06);
}

/* ========================================
   READING GUIDE
   ======================================== */

.a11y-reading-guide {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: rgba(255, 235, 59, 0.2);
  border-top: 2px solid rgba(255, 193, 7, 0.5);
  border-bottom: 2px solid rgba(255, 193, 7, 0.5);
  pointer-events: none;
  z-index: 9998;
  display: none;
  transition: top 0.05s linear;
}

.a11y-reading-guide.a11y-reading-guide-visible {
  display: block;
}

/* ========================================
   COLOR OVERLAY
   ======================================== */

.a11y-color-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9997;
  mix-blend-mode: multiply;
  display: none;
}

.a11y-color-overlay.a11y-color-overlay-visible {
  display: block;
}

/* ========================================
   HIGHLIGHTS & ANNOTATIONS
   ======================================== */

/* User text highlights (inline spans) */
.a11y-highlight {
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: filter 0.2s ease;
}

.a11y-highlight:hover {
  filter: brightness(0.92);
}

/* Note indicator dot */
.a11y-highlight-has-note::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: #1565c0;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Flash animation for scrolling to a highlight */
.a11y-highlight-flash {
  animation: a11yHighlightFlash 1.5s ease;
}

@keyframes a11yHighlightFlash {
  0%   { outline: 3px solid transparent; outline-offset: 2px; }
  15%  { outline: 3px solid #1565c0; outline-offset: 2px; }
  30%  { outline: 3px solid transparent; outline-offset: 2px; }
  45%  { outline: 3px solid #1565c0; outline-offset: 2px; }
  100% { outline: 3px solid transparent; outline-offset: 2px; }
}

/* Highlight mode cursor change */
body.a11y-highlight-mode .page .content,
body.a11y-highlight-mode .page .content-section {
  cursor: text;
}

body.a11y-highlight-mode .page .content ::selection,
body.a11y-highlight-mode .page .content-section ::selection {
  background: rgba(255, 235, 59, 0.5);
}

/* ========================================
   SELECTION POPUP (appears after selecting text)
   ======================================== */

.a11y-sel-popup {
  position: absolute;
  z-index: 10001;
  display: none;
  pointer-events: none;
}

.a11y-sel-popup.a11y-sel-popup-visible {
  display: block;
  pointer-events: auto;
}

.a11y-sel-popup-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 1px 4px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
}

.a11y-sel-popup-colors {
  display: flex;
  gap: 4px;
}

.a11y-sel-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  transition: transform 0.15s ease;
  padding: 0;
}

.a11y-sel-color:hover {
  transform: scale(1.2);
}

.a11y-sel-note-btn {
  width: 28px;
  height: 28px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  color: #555;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
  margin-left: 4px;
}

.a11y-sel-note-btn:hover {
  border-color: #1565c0;
  color: #1565c0;
  background: #e3f2fd;
}

/* ========================================
   ANNOTATION POPUP (appears when clicking a highlight)
   ======================================== */

.a11y-annotation-popup {
  position: absolute;
  z-index: 10001;
  display: none;
  pointer-events: none;
  max-width: 320px;
}

.a11y-annotation-popup.a11y-annotation-popup-visible {
  display: block;
  pointer-events: auto;
}

.a11y-ann-popup-inner {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2), 0 1px 4px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.a11y-ann-popup-header {
  padding: 10px 14px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.a11y-ann-popup-text {
  font-size: 13px;
  color: #555;
  font-style: italic;
  line-height: 1.5;
  display: block;
}

.a11y-ann-popup-note {
  padding: 10px 14px;
  font-size: 13px;
  color: #333;
  line-height: 1.6;
  background: #fff;
}

.a11y-ann-popup-actions {
  display: flex;
  border-top: 1px solid #eee;
}

.a11y-ann-popup-actions button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.a11y-ann-popup-actions button:first-child {
  border-right: 1px solid #eee;
}

.a11y-ann-edit {
  color: #1565c0;
}

.a11y-ann-edit:hover {
  background: #e3f2fd;
}

.a11y-ann-delete {
  color: #c62828;
}

.a11y-ann-delete:hover {
  background: #ffebee;
}

/* ========================================
   NOTES TAB - HIGHLIGHT COLOR PICKER
   ======================================== */

.a11y-hl-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.a11y-hl-color {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 3px solid;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  position: relative;
}

.a11y-hl-color:hover {
  transform: scale(1.1);
}

.a11y-hl-color.a11y-hl-color-active {
  box-shadow: 0 0 0 2px white, 0 0 0 4px #1565c0;
}

.a11y-hl-color.a11y-hl-color-active::after {
  content: "\2713";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 700;
  color: rgba(0,0,0,0.5);
}

/* Hint text */
.a11y-hint {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
  margin: 8px 0 0 0;
}

/* ========================================
   NOTES TAB - NOTES LIST
   ======================================== */

.a11y-notes-badge {
  display: inline-block;
  background: #1565c0;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  min-width: 18px;
  text-align: center;
}

.a11y-notes-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}

.a11y-notes-empty {
  padding: 20px 14px;
  text-align: center;
  color: #999;
  font-size: 12px;
  line-height: 1.6;
}

.a11y-note-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.a11y-note-item:last-child {
  border-bottom: none;
}

.a11y-note-item:hover {
  background: #f5f8ff;
}

.a11y-note-color-bar {
  width: 4px;
  flex-shrink: 0;
}

.a11y-note-content {
  flex: 1;
  padding: 8px 10px;
  min-width: 0;
}

.a11y-note-text {
  font-size: 12px;
  color: #555;
  font-style: italic;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a11y-note-annotation {
  font-size: 12px;
  color: #333;
  margin-top: 4px;
  line-height: 1.4;
  font-weight: 600;
}

.a11y-note-delete {
  width: 32px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: #bbb;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.a11y-note-delete:hover {
  color: #c62828;
  background: #ffebee;
}

/* ========================================
   BODY MODIFIER: HIGH CONTRAST
   ======================================== */

body.a11y-high-contrast {
  background: #000 !important;
}

body.a11y-high-contrast .page,
body.a11y-high-contrast .container,
body.a11y-high-contrast .content,
body.a11y-high-contrast .card {
  background: #1a1a2e !important;
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .header,
body.a11y-high-contrast .hero,
body.a11y-high-contrast .top-bar {
  background: #1a1a2e !important;
  color: #e0e0e0 !important;
}

body.a11y-high-contrast a {
  color: #64b5f6 !important;
}

body.a11y-high-contrast button,
body.a11y-high-contrast .btn {
  border-color: #64b5f6 !important;
}

body.a11y-high-contrast .header h1 {
  color: #64b5f6 !important;
}

body.a11y-high-contrast .header .subtitle,
body.a11y-high-contrast .header .attribution {
  color: #bbb !important;
}

body.a11y-high-contrast h2 {
  color: #64b5f6 !important;
  border-bottom-color: #444 !important;
}

body.a11y-high-contrast h3 {
  color: #90caf9 !important;
}

body.a11y-high-contrast h4 {
  color: #e0e0e0 !important;
}

body.a11y-high-contrast p,
body.a11y-high-contrast li,
body.a11y-high-contrast td,
body.a11y-high-contrast span,
body.a11y-high-contrast label {
  color: #e0e0e0 !important;
}

body.a11y-high-contrast strong {
  color: #90caf9 !important;
}

body.a11y-high-contrast blockquote {
  background: #2a2a3e !important;
  color: #ccc !important;
  border-left-color: #64b5f6 !important;
}

body.a11y-high-contrast .info-box {
  background: #2a2a3e !important;
  color: #e0e0e0 !important;
  border-left-color: #64b5f6 !important;
}

body.a11y-high-contrast .info-box h3,
body.a11y-high-contrast .info-box h4 {
  color: #90caf9 !important;
}

body.a11y-high-contrast .info-box.success {
  border-left-color: #66bb6a !important;
}

body.a11y-high-contrast .info-box.warning {
  border-left-color: #ffa726 !important;
}

body.a11y-high-contrast .highlight-box {
  background: #2a2a3e !important;
  border-color: #555 !important;
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .vocab-term {
  background: #0d47a1 !important;
}

body.a11y-high-contrast .vocab-card {
  background: #2a2a3e !important;
  border-color: #555 !important;
}

body.a11y-high-contrast .vocab-definition {
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .content-table th {
  background: #0d47a1 !important;
}

body.a11y-high-contrast .content-table td {
  border-bottom-color: #444 !important;
}

body.a11y-high-contrast .content-table tr:nth-child(even) {
  background: #2a2a3e !important;
}

body.a11y-high-contrast .content-table tr:hover {
  background: #333 !important;
}

body.a11y-high-contrast .option {
  background: #2a2a3e !important;
  border-color: #555 !important;
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .option:hover {
  background: #333 !important;
  border-color: #64b5f6 !important;
}

body.a11y-high-contrast .option span {
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .question {
  background: #2a2a3e !important;
  border-color: #555 !important;
}

body.a11y-high-contrast .question h3 {
  color: #64b5f6 !important;
}

body.a11y-high-contrast .question-text {
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .navigation {
  border-top-color: #555 !important;
}

body.a11y-high-contrast .gate-message {
  color: #ef9a9a !important;
}

body.a11y-high-contrast .objectives-list li {
  background: #2a2a3e !important;
  border-left-color: #64b5f6 !important;
  color: #e0e0e0 !important;
}

body.a11y-high-contrast .figure-box figcaption {
  background: #2a2a3e !important;
  color: #ccc !important;
  border-top-color: #555 !important;
}

body.a11y-high-contrast .figure-box {
  background: #1a1a2e !important;
  border-color: #555 !important;
}

body.a11y-high-contrast .checkpoint-banner {
  background: #2a2a3e !important;
  border-left-color: #64b5f6 !important;
}

body.a11y-high-contrast .checkpoint-banner .text {
  color: #90caf9 !important;
}

body.a11y-high-contrast .progress-bar {
  background: #333 !important;
}

body.a11y-high-contrast .section-label {
  background: #0d47a1 !important;
}

/* High contrast: highlight adjustments */
body.a11y-high-contrast .a11y-highlight {
  filter: brightness(1.2);
}

body.a11y-high-contrast .a11y-highlight-has-note::after {
  background: #42a5f5;
}

/* ========================================
   BODY MODIFIER: DYSLEXIA FONT
   ======================================== */

body.a11y-dyslexia-font,
body.a11y-dyslexia-font * {
  font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

body.a11y-dyslexia-font .a11y-panel,
body.a11y-dyslexia-font .a11y-panel * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
}

/* ========================================
   BODY MODIFIER: LINE SPACING
   ======================================== */

body.a11y-line-spacing-wide p,
body.a11y-line-spacing-wide li,
body.a11y-line-spacing-wide td,
body.a11y-line-spacing-wide span,
body.a11y-line-spacing-wide label,
body.a11y-line-spacing-wide div {
  line-height: 2.2 !important;
}

body.a11y-line-spacing-extra p,
body.a11y-line-spacing-extra li,
body.a11y-line-spacing-extra td,
body.a11y-line-spacing-extra span,
body.a11y-line-spacing-extra label,
body.a11y-line-spacing-extra div {
  line-height: 2.8 !important;
}

body.a11y-line-spacing-wide .a11y-panel *,
body.a11y-line-spacing-extra .a11y-panel * {
  line-height: normal !important;
}

/* ========================================
   BODY MODIFIER: FOCUS MODE
   ======================================== */

body.a11y-focus-mode .page > .container > .content > *,
body.a11y-focus-mode .content-section > *,
body.a11y-focus-mode .content > * {
  opacity: 0.25;
  transition: opacity 0.2s ease;
}

body.a11y-focus-mode .page > .container > .content > *:hover,
body.a11y-focus-mode .content-section > *:hover,
body.a11y-focus-mode .content > *:hover,
body.a11y-focus-mode .a11y-tts-highlight,
body.a11y-focus-mode .a11y-focus-active {
  opacity: 1 !important;
}

body.a11y-focus-mode .navigation,
body.a11y-focus-mode .a11y-panel,
body.a11y-focus-mode .a11y-fab,
body.a11y-focus-mode .header,
body.a11y-focus-mode .progress-bar {
  opacity: 1 !important;
}

/* ========================================
   BODY MODIFIER: REDUCED MOTION
   ======================================== */

body.a11y-reduced-motion *,
body.a11y-reduced-motion *::before,
body.a11y-reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ========================================
   BODY MODIFIER: FONT SIZE SCALE
   ======================================== */

body.a11y-font-scale-1 { font-size: 85% !important; }
body.a11y-font-scale-2 { font-size: 90% !important; }
body.a11y-font-scale-3 { font-size: 95% !important; }
/* scale-4 = default (no class needed) */
body.a11y-font-scale-5 { font-size: 110% !important; }
body.a11y-font-scale-6 { font-size: 120% !important; }
body.a11y-font-scale-7 { font-size: 135% !important; }
body.a11y-font-scale-8 { font-size: 150% !important; }
body.a11y-font-scale-9 { font-size: 170% !important; }

/* ========================================
   RESPONSIVE: MOBILE PANEL
   ======================================== */

@media (max-width: 768px) {
  .a11y-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
  }

  .a11y-fab {
    bottom: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
  }

  .a11y-fab svg {
    width: 24px;
    height: 24px;
  }

  .a11y-sel-popup {
    left: 10px !important;
    right: 10px;
    width: auto;
  }

  .a11y-annotation-popup {
    left: 10px !important;
    right: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .a11y-panel {
    max-height: 80vh;
  }

  .a11y-tab {
    font-size: 10px;
    padding: 8px 2px;
  }

  .a11y-tab svg {
    width: 16px;
    height: 16px;
  }
}
