/**
 * Web Accessibility Widget - Master Stylesheet
 * Self-contained, isolated styles for widget UI and global accessibility transformations.
 */

/* ==========================================================================
   1. OpenDyslexic / High Legibility Font Definition
   ========================================================================== */
@font-face {
  font-family: 'OpenDyslexic3';
  font-style: normal;
  font-weight: 400;
  src: local('OpenDyslexic3'), local('OpenDyslexic'), local('Comic Sans MS');
}

/* ==========================================================================
   2. Widget Design Tokens & Scoped Styles
   ========================================================================== */
:root {
  --aw-primary: #4f46e5;
  --aw-primary-hover: #4338ca;
  --aw-primary-light: #eef2ff;
  --aw-accent: #06b6d4;
  --aw-success: #10b981;
  --aw-warning: #f59e0b;
  --aw-danger: #ef4444;
  --aw-bg-card: #ffffff;
  --aw-bg-panel: #ffffff;
  --aw-text-main: #1f2937;
  --aw-text-muted: #6b7280;
  --aw-border: #e5e7eb;
  --aw-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  --aw-radius-md: 12px;
  --aw-radius-lg: 18px;
  --aw-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --aw-z-index: 2147483640;
}

.aw-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;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   3. Trigger Floating Button
   ========================================================================== */
.aw-trigger-btn {
  position: fixed;
  z-index: var(--aw-z-index);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  touch-action: none;
}

.aw-trigger-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.6);
}

.aw-trigger-btn:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 4px;
}

.aw-trigger-btn.aw-dragging {
  cursor: grabbing;
  transform: scale(1.12);
  transition: none;
}

.aw-trigger-btn svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Position classes */
.aw-pos-bottom-right { bottom: 24px; right: 24px; }
.aw-pos-bottom-left  { bottom: 24px; left: 24px; }
.aw-pos-top-right    { top: 24px; right: 24px; }
.aw-pos-top-left     { top: 24px; left: 24px; }

.aw-trigger-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #047857;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: none;
}

.aw-trigger-btn.aw-has-active-settings .aw-trigger-badge {
  display: block;
}

/* ==========================================================================
   4. Main Panel / Modal Drawer
   ========================================================================== */
.aw-widget-container {
  font-family: var(--aw-font-family);
  box-sizing: border-box;
}

.aw-widget-container * {
  box-sizing: border-box;
}

.aw-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: var(--aw-z-index);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.aw-backdrop.aw-open {
  opacity: 1;
  visibility: visible;
}

.aw-panel {
  position: fixed;
  top: 0;
  right: -520px;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  background: var(--aw-bg-panel);
  color: var(--aw-text-main);
  box-shadow: var(--aw-shadow-lg);
  z-index: calc(var(--aw-z-index) + 1);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid var(--aw-border);
}

.aw-panel.aw-open {
  transform: translateX(-520px);
}

/* Header */
.aw-panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--aw-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.aw-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aw-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aw-header-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.aw-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.aw-header-subtitle {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--aw-text-muted);
}

.aw-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aw-btn-icon {
  background: transparent;
  border: 1px solid var(--aw-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--aw-text-muted);
  transition: all 0.2s ease;
}

.aw-btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.aw-btn-icon:focus-visible {
  outline: 3px solid #4f46e5;
}

.aw-btn-reset {
  font-size: 12px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.aw-btn-reset:hover {
  background: #fee2e2;
}

/* Tabs Navigation */
.aw-tabs-nav {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--aw-border);
  background: #ffffff;
  padding: 4px 12px 0 12px;
  gap: 4px;
  scrollbar-width: none;
}

.aw-tabs-nav::-webkit-scrollbar {
  display: none;
}

.aw-tab-btn {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--aw-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.aw-tab-btn:hover {
  color: #4f46e5;
}

.aw-tab-btn.aw-tab-active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

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

/* Panel Body */
.aw-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  background: #f8fafc;
}

.aw-tab-content {
  display: none;
}

.aw-tab-content.aw-content-active {
  display: block;
}

/* Section Titles & Cards */
.aw-section-header {
  margin-bottom: 16px;
}

.aw-section-title {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.aw-section-desc {
  margin: 0;
  font-size: 12px;
  color: var(--aw-text-muted);
}

.aw-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.aw-grid-1 {
  grid-template-columns: 1fr;
}

.aw-card {
  background: #ffffff;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  text-align: left;
  user-select: none;
}

.aw-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.aw-card:focus-visible {
  outline: 3px solid #4f46e5;
  outline-offset: 2px;
}

.aw-card.aw-card-active {
  border-color: #4f46e5;
  background: #f5f3ff;
  box-shadow: 0 0 0 1px #4f46e5;
}

.aw-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.aw-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aw-card-active .aw-card-icon {
  background: #4f46e5;
  color: #ffffff;
}

.aw-card-icon svg {
  width: 18px;
  height: 18px;
}

.aw-card-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 6px;
  border-radius: 6px;
}

.aw-card-active .aw-card-badge {
  background: #047857;
  color: #ffffff;
}

.aw-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
}

.aw-card-desc {
  font-size: 11px;
  color: var(--aw-text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Stepper / Multi-value Controls */
.aw-stepper-box {
  background: #ffffff;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.aw-stepper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.aw-stepper-label {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.aw-stepper-val {
  font-size: 12px;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 6px;
}

.aw-stepper-actions {
  display: flex;
  gap: 8px;
}

.aw-btn-step {
  flex: 1;
  height: 36px;
  background: #f8fafc;
  border: 1px solid var(--aw-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.aw-btn-step:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

.aw-btn-step:focus-visible {
  outline: 3px solid #4f46e5;
}

/* Button Group / Pills */
.aw-pills-group {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.aw-pill-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--aw-text-muted);
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.aw-pill-btn:hover {
  color: #0f172a;
}

.aw-pill-btn.aw-pill-active {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.aw-pill-btn:focus-visible {
  outline: 2px solid #4f46e5;
}

/* Color Swatches Grid */
.aw-color-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.aw-swatch-card {
  border: 2px solid var(--aw-border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s ease;
}

.aw-swatch-card:hover {
  border-color: #94a3b8;
}

.aw-swatch-card.aw-swatch-active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5;
  background: #f5f3ff;
}

.aw-swatch-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto 6px auto;
  border: 1px solid rgba(0,0,0,0.1);
}

.aw-swatch-name {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  display: block;
}

/* TTS Player Controls */
.aw-tts-player {
  background: #ffffff;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.aw-tts-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}

.aw-tts-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.aw-tts-indicator.aw-active {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: aw-pulse-dot 1.5s infinite;
}

@keyframes aw-pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.aw-tts-btns {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.aw-btn-primary {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  transition: background 0.2s ease;
}

.aw-btn-primary:hover {
  background: #4338ca;
}

.aw-btn-primary:focus-visible {
  outline: 3px solid #f59e0b;
}

/* Structure Tree List */
.aw-structure-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
}

.aw-structure-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--aw-border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aw-structure-item:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.aw-structure-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #e0e7ff;
  color: #4338ca;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Footer Info */
.aw-panel-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--aw-border);
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--aw-text-muted);
}

.aw-shortcut-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  color: #334155;
}

/* ==========================================================================
   5. Visual Aids Overlays (Reading Ruler, Mask, Magnifier)
   ========================================================================== */
.aw-reading-ruler {
  position: fixed;
  left: 0;
  width: 100vw;
  height: 36px;
  background: rgba(255, 235, 59, 0.28);
  border-top: 2px solid #f59e0b;
  border-bottom: 2px solid #f59e0b;
  pointer-events: none;
  z-index: calc(var(--aw-z-index) - 5);
  display: none;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
  transform: translateY(-50%);
}

.aw-reading-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: calc(var(--aw-z-index) - 10);
  display: none;
}

.aw-mask-top,
.aw-mask-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.72);
}

.aw-mask-top {
  top: 0;
  height: 35vh;
}

.aw-mask-spotlight {
  position: absolute;
  left: 0;
  width: 100%;
  height: 90px;
  top: 35vh;
  box-shadow: 0 0 30px rgba(0,0,0,0.8);
  background: transparent;
}

.aw-mask-bottom {
  top: calc(35vh + 90px);
  bottom: 0;
}

.aw-text-magnifier {
  position: fixed;
  z-index: var(--aw-z-index);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  max-width: 450px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
  border: 2px solid #38bdf8;
  pointer-events: none;
  display: none;
}

/* ==========================================================================
   6. Global Accessibility Transformations (Applied to HTML / Body)
   ========================================================================== */

/* Font Sizing Steps */
html[data-aw-font-size="80"] body { font-size: 80% !important; }
html[data-aw-font-size="90"] body { font-size: 90% !important; }
html[data-aw-font-size="110"] body { font-size: 110% !important; }
html[data-aw-font-size="120"] body { font-size: 120% !important; }
html[data-aw-font-size="130"] body { font-size: 130% !important; }
html[data-aw-font-size="140"] body { font-size: 140% !important; }
html[data-aw-font-size="150"] body { font-size: 150% !important; }
html[data-aw-font-size="160"] body { font-size: 160% !important; }
html[data-aw-font-size="180"] body { font-size: 180% !important; }
html[data-aw-font-size="200"] body { font-size: 200% !important; }

/* Dyslexia Friendly Font */
html[data-aw-dyslexic-font="true"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  font-family: 'OpenDyslexic3', 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
}

/* Readable Sans-Serif Font */
html[data-aw-readable-font="true"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
}

/* Line Height */
html[data-aw-line-height="1.5"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  line-height: 1.5 !important;
}
html[data-aw-line-height="1.8"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  line-height: 1.8 !important;
}
html[data-aw-line-height="2.0"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  line-height: 2.0 !important;
}

/* Letter Spacing */
html[data-aw-letter-spacing="wide"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}
html[data-aw-letter-spacing="wider"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  letter-spacing: 0.22em !important;
  word-spacing: 0.28em !important;
}

/* Text Alignment */
html[data-aw-text-align="left"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  text-align: left !important;
}
html[data-aw-text-align="center"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  text-align: center !important;
}
html[data-aw-text-align="right"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  text-align: right !important;
}
html[data-aw-text-align="justify"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  text-align: justify !important;
}

/* Highlight Links */
html[data-aw-highlight-links="true"] a:not(.aw-widget-container a):not(.aw-trigger-btn) {
  text-decoration: underline 3px solid #f59e0b !important;
  text-underline-offset: 4px !important;
  background-color: rgba(245, 158, 11, 0.18) !important;
  color: #1e1b4b !important;
  font-weight: 700 !important;
  border-radius: 3px !important;
  padding: 0 4px !important;
}

/* Highlight Headings */
html[data-aw-highlight-headings="true"] h1:not(.aw-widget-container h1),
html[data-aw-highlight-headings="true"] h2:not(.aw-widget-container h2),
html[data-aw-highlight-headings="true"] h3:not(.aw-widget-container h3),
html[data-aw-highlight-headings="true"] h4:not(.aw-widget-container h4),
html[data-aw-highlight-headings="true"] h5:not(.aw-widget-container h5),
html[data-aw-highlight-headings="true"] h6:not(.aw-widget-container h6) {
  outline: 2px dashed #4f46e5 !important;
  outline-offset: 4px !important;
  background-color: rgba(79, 70, 229, 0.08) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
}

/* Focus Outline */
html[data-aw-focus-outline="true"] *:focus-visible {
  outline: 4px solid #f59e0b !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7) !important;
}

/* Large Click Targets */
html[data-aw-large-targets="true"] button:not(.aw-widget-container button):not(.aw-trigger-btn),
html[data-aw-large-targets="true"] a:not(.aw-widget-container a),
html[data-aw-large-targets="true"] input:not(.aw-widget-container input),
html[data-aw-large-targets="true"] select,
html[data-aw-large-targets="true"] textarea {
  min-height: 48px !important;
  min-width: 48px !important;
  padding: 10px 16px !important;
  font-size: 15px !important;
}

/* ==========================================================================
   7. Color & Contrast Modes
   ========================================================================== */

/* Dark High Contrast */
html[data-aw-contrast="dark"] {
  background-color: #0b0f19 !important;
  color: #f8fafc !important;
}
html[data-aw-contrast="dark"] body {
  background-color: #0b0f19 !important;
  color: #f8fafc !important;
}
html[data-aw-contrast="dark"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  background-color: transparent !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}
html[data-aw-contrast="dark"] a:not(.aw-widget-container a) {
  color: #38bdf8 !important;
}
html[data-aw-contrast="dark"] img,
html[data-aw-contrast="dark"] video {
  filter: contrast(110%) brightness(90%);
}

/* Light High Contrast */
html[data-aw-contrast="light"] {
  background-color: #ffffff !important;
  color: #000000 !important;
}
html[data-aw-contrast="light"] body {
  background-color: #ffffff !important;
  color: #000000 !important;
  /* Applied to body (not html): a filter on html would make it the containing block for every
     position:fixed descendant (the widget included), knocking the widget's button/panel off
     their normal viewport-anchored position. The widget itself lives outside <body> (see
     accessibility-widget.js render()) precisely so it is never affected by these filters. */
  filter: contrast(130%) !important;
}
html[data-aw-contrast="light"] *:not(.aw-widget-container *):not(.aw-trigger-btn *) {
  color: #000000 !important;
  border-color: #000000 !important;
}

/* Invert Colors */
html[data-aw-contrast="invert"] body {
  filter: invert(100%) hue-rotate(180deg) !important;
}
html[data-aw-contrast="invert"] img,
html[data-aw-contrast="invert"] video {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Monochrome */
html[data-aw-contrast="monochrome"] body {
  filter: grayscale(100%) !important;
}

/* Warm Tone / Sepia */
html[data-aw-contrast="sepia"] body {
  filter: sepia(45%) !important;
}

/* Saturation */
html[data-aw-saturation="low"] body {
  filter: saturate(40%) !important;
}
html[data-aw-saturation="high"] body {
  filter: saturate(180%) !important;
}

/* ==========================================================================
   8. Animation Blocker
   ========================================================================== */
html[data-aw-stop-animations="true"] *,
html[data-aw-stop-animations="true"] *::before,
html[data-aw-stop-animations="true"] *::after {
  animation: none !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition: none !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ==========================================================================
   9. Custom Large Cursors (SVG Data URIs)
   ========================================================================== */
html[data-aw-big-cursor="white"],
html[data-aw-big-cursor="white"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' stroke='%23000000' stroke-width='1.5' stroke-linejoin='round' d='M4 3l12 9-5.5 1 3.5 7-3 1.5-3.5-7-3.5 3.5z'/%3E%3C/svg%3E"), auto !important;
}

html[data-aw-big-cursor="black"],
html[data-aw-big-cursor="black"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round' d='M4 3l12 9-5.5 1 3.5 7-3 1.5-3.5-7-3.5 3.5z'/%3E%3C/svg%3E"), auto !important;
}

/* ==========================================================================
   10. TTS Interactive Highlights & Jump FX
   ========================================================================== */
.aw-click-to-read-active {
  cursor: help !important;
}

.aw-tts-hover {
  outline: 3px solid #3b82f6 !important;
  outline-offset: 2px !important;
  background-color: rgba(59, 130, 246, 0.15) !important;
  border-radius: 4px !important;
}

.aw-tts-speaking-target {
  outline: 3px solid #10b981 !important;
  outline-offset: 2px !important;
  background-color: rgba(16, 185, 129, 0.2) !important;
  border-radius: 4px !important;
}

@keyframes aw-jump-pulse {
  0% { outline: 4px solid #f59e0b; background-color: rgba(245, 158, 11, 0.3); }
  50% { outline: 6px solid #4f46e5; background-color: rgba(79, 70, 229, 0.3); }
  100% { outline: 2px solid transparent; background-color: transparent; }
}

.aw-highlight-jump {
  animation: aw-jump-pulse 2.2s ease-out forwards !important;
}

/* ==========================================================================
   11. Mobile Responsiveness
   ========================================================================== */
@media (max-width: 640px) {
  .aw-panel {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }
  .aw-panel.aw-open {
    transform: translateX(-100vw);
  }
  .aw-grid {
    grid-template-columns: 1fr;
  }
  .aw-trigger-btn {
    width: 48px;
    height: 48px;
  }
  .aw-trigger-btn svg {
    width: 24px;
    height: 24px;
  }
}
