:root {
  --a11y-font-scale: 1;
  --a11y-contrast-scale: 1;
  --a11y-line-height: normal;
  --a11y-word-spacing: normal;
  --a11y-letter-spacing: normal;
  --a11y-saturation: 1;

  /* Brand Colors */
  --ps-a11y-brand: #0b57d0;
  --ps-a11y-bg: #ffffff;
  --ps-a11y-text: #333333;
  --ps-a11y-border: #e0e0e0;
  --ps-a11y-hover: #f5f7fa;
  --ps-a11y-active: #e8f0fe;
  --ps-a11y-active-profile-bg: #e8f0fe;
  --ps-a11y-active-profile-text: #0b57d0;
}

/* ===== Widget Container ===== */
/* Fixed container for the button, anchored to bottom-right or bottom-left */
.ps-a11y-widget {
  position: fixed !important;
  bottom: var(--ps-a11y-bottom-offset, 20px);
  right: 20px;
  z-index: 2147483647;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* Align items to the right by default */
  pointer-events: none;
}

/* Left Position Override */
.ps-a11y-widget.ps-a11y-left {
  right: auto !important;
  left: 20px !important;
  align-items: flex-start;
  /* Align items to the left */
}

/* ===== Floating Button ===== */
.ps-a11y-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--ps-a11y-brand);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0;
  outline: none;
  position: relative;
  z-index: 2;
  /* Ensure button is clickcable */
  flex-shrink: 0;
  pointer-events: auto;
}

.ps-a11y-btn:hover,
.ps-a11y-btn:focus {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.ps-a11y-btn svg,
.ps-a11y-btn i.fa {
  width: 28px;
  height: 28px;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Main Panel (Sidebar Style) ===== */
.ps-a11y-panel {
  position: fixed;
  /* Fixed relative to viewport */
  top: 0;
  /* Start at very top */
  bottom: 0;
  /* End at very bottom */
  right: 0;
  /* Aligned to right edge */
  width: 300px;
  background-color: var(--ps-a11y-bg);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
  /* Shadow on left */
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Remove border radius on sidebar side */
  border-radius: 12px 0 0 12px;

  transition: transform 0.3s ease, visibility 0.3s;
  transform: translateX(100%);
  /* Start off-screen right */
  visibility: hidden;
  pointer-events: none;
  font-size: 14px;
  color: var(--ps-a11y-text);
  border-left: 1px solid var(--ps-a11y-border);
  z-index: 2147483648;
  /* Above everything including widget button */
}

/* Left Position Panel Override */
.ps-a11y-widget.ps-a11y-left .ps-a11y-panel {
  right: auto;
  left: 0;
  /* Aligned to left edge */
  transform: translateX(-100%);
  /* Start off-screen left */
  border-radius: 0 12px 12px 0;
  box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2);
  /* Shadow on right */
  border-left: none;
  border-right: 1px solid var(--ps-a11y-border);
}

/* Visible State - Default (Right) */
.ps-a11y-panel[aria-hidden="false"],
.ps-a11y-panel:not([hidden]) {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* Visible State - Left Override */
.ps-a11y-widget.ps-a11y-left .ps-a11y-panel[aria-hidden="false"],
.ps-a11y-widget.ps-a11y-left .ps-a11y-panel:not([hidden]) {
  transform: translateX(0);
}

.ps-a11y-panel[hidden] {
  display: none !important;
}

/* ===== Header ===== */
.ps-a11y-panel-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ps-a11y-border);
  background: #f8f9fa;
  flex-shrink: 0;
  /* Header doesn't shrink */
}

.ps-a11y-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ps-a11y-brand);
  font-size: 14px;
  font-weight: 600;
}

.ps-a11y-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ps-a11y-reset {
  font-size: 12px;
  color: #666;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.ps-a11y-reset:hover {
  width: auto;
  color: var(--ps-a11y-brand);
}

.ps-a11y-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  color: #555;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-a11y-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}

/* ===== Scroll Content Wrapper ===== */
.ps-a11y-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  /* Firefox flex scroll fix */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.ps-a11y-scroll-content::-webkit-scrollbar {
  width: 6px;
}

.ps-a11y-scroll-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* ===== Grid Layout ===== */
.ps-a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px;
  gap: 10px;
}

.ps-a11y-grid-btn {
  background: white;
  border: 1px solid var(--ps-a11y-border);
  border-radius: 8px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease-out;
  position: relative;
  min-height: 90px;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ps-a11y-grid-btn:hover {
  background: var(--ps-a11y-hover);
  border-color: #ccc;
  transform: translateY(-1px);
}

.ps-a11y-grid-btn.active {
  background: var(--ps-a11y-active);
  border-color: var(--ps-a11y-brand);
  color: var(--ps-a11y-brand);
  box-shadow: 0 0 0 1px var(--ps-a11y-brand) inset;
}

.ps-a11y-icon {
  color: #5f6368;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.ps-a11y-icon i.fa {
  font-size: 24px;
}

.ps-a11y-grid-btn.active .ps-a11y-icon {
  color: var(--ps-a11y-brand);
}

.ps-a11y-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: #333;
}

.ps-a11y-grid-btn.active .ps-a11y-label {
  color: var(--ps-a11y-brand);
}

/* Status Indicator */
.ps-a11y-status {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ps-a11y-brand);
  display: none;
}

.ps-a11y-grid-btn.active .ps-a11y-status {
  display: block;
}

/* Toggle Icons */
.ps-a11y-icon-play {
  display: none;
}

.ps-a11y-grid-btn.active .ps-a11y-icon-pause {
  display: none;
}

.ps-a11y-grid-btn.active .ps-a11y-icon-play {
  display: block;
}

.ps-a11y-icon-play.fa,
.ps-a11y-icon-pause.fa {
  font-size: 24px !important;
}

/* ===== Footer ===== */
.ps-a11y-footer-info {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  background: #f8f9fa;
  border-top: 1px solid var(--ps-a11y-border);
  flex-shrink: 0;
}

#ps-a11y-widget .ps-a11y-link,
#footer-container-main #ps-a11y-widget .ps-a11y-link,
#checkout-footer #ps-a11y-widget .ps-a11y-link {
  display: block !important;
  color: var(--ps-a11y-brand) !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  margin-top: 10px !important;
  padding: 5px !important;
  font-size: 12px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#ps-a11y-widget .ps-a11y-link:hover {
  text-decoration: underline !important;
  opacity: 0.8 !important;
}

/* ===== Base Adjustments ===== */
html {
  font-size: calc(100% * var(--a11y-font-scale)) !important;
  filter: contrast(var(--a11y-contrast-scale)) saturate(var(--a11y-saturation));
}

body {
  line-height: var(--a11y-line-height) !important;
  word-spacing: var(--a11y-word-spacing) !important;
  letter-spacing: var(--a11y-letter-spacing) !important;
  text-align: var(--a11y-text-align, initial);
}

/* Highlight Links */
html.a11y-highlight-links a {
  text-decoration: underline !important;
  background-color: yellow !important;
  color: black !important;
}

html.a11y-highlight-links a * {
  color: black !important;
}

/* Dyslexia */
html.a11y-dyslexia * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif !important;
}

/* Cursor */
html.a11y-cursor,
html.a11y-cursor * {
  cursor: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpolygon points='6,6 30,28 20,28 28,56 18,56 12,30 6,30' fill='white' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 6 6, auto !important;
}

/* Cursor Guide */
.ps-a11y-cursor-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 15px;
  background: rgba(255, 255, 0, 0.4);
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
  z-index: 2147483647;
  pointer-events: none;
  transform: translateY(-50%);
}

/* Cursor Mask */
.ps-a11y-cursor-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483647;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: none;
  --y: 50vh;
  -webkit-mask-image: linear-gradient(to bottom, black calc(var(--y) - 50px), transparent calc(var(--y) - 50px), transparent calc(var(--y) + 50px), black calc(var(--y) + 50px));
  mask-image: linear-gradient(to bottom, black calc(var(--y) - 50px), transparent calc(var(--y) - 50px), transparent calc(var(--y) + 50px), black calc(var(--y) + 50px));
}

/* Hide Images */
html.a11y-hide-images img,
html.a11y-hide-images svg,
html.a11y-hide-images video,
html.a11y-hide-images iframe {
  opacity: 0 !important;
  visibility: hidden !important;
}

html.a11y-hide-images * {
  background-image: none !important;
}

/* Invert Mode & Overlay */
.ps-a11y-overlay-invert {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  pointer-events: none;
  backdrop-filter: invert(1) hue-rotate(180deg) contrast(var(--a11y-contrast-scale)) saturate(var(--a11y-saturation));
  -webkit-backdrop-filter: invert(1) hue-rotate(180deg) contrast(var(--a11y-contrast-scale)) saturate(var(--a11y-saturation));
}

html.a11y-invert {
  filter: none;
}

html.a11y-invert .ps-a11y-widget {
  filter: none;
}

/* Dark Mode Widget Overrides */
html.a11y-invert .ps-a11y-panel {
  background: #1a1a1a;
  color: #eee;
  border-color: #444;
}

html.a11y-invert .ps-a11y-panel-header,
html.a11y-invert .ps-a11y-footer-info {
  background: #252525;
  border-color: #444;
}

html.a11y-invert .ps-a11y-grid-btn {
  background: #2a2a2a;
  border-color: #444;
}

html.a11y-invert .ps-a11y-grid-btn:hover {
  background: #333;
}

html.a11y-invert .ps-a11y-grid-btn.active {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

html.a11y-invert .ps-a11y-label {
  color: #ddd;
}

/* XL Widget */
.ps-a11y-widget.ps-a11y-xl .ps-a11y-grid-btn {
  min-height: 120px;
  font-size: 1.25em;
}

.ps-a11y-widget.ps-a11y-xl .ps-a11y-profile-btn {
  padding: 15px;
  font-size: 1.1em;
}

.ps-a11y-widget.ps-a11y-xl {
  font-size: 18px;
}

.ps-a11y-widget.ps-a11y-xl .ps-a11y-label {
  font-size: 14px;
}

.ps-a11y-widget.ps-a11y-xl .ps-a11y-btn {
  width: 70px;
  height: 70px;
}

.ps-a11y-widget.ps-a11y-xl .ps-a11y-btn svg {
  width: 40px;
  height: 40px;
}

/* 2-Col Profile List */
.ps-a11y-profile-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--ps-a11y-border);
}

/* Profile Buttons */
.ps-a11y-profile-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 12px 15px;
  border: 1px solid #f0f0f0;
  border-radius: 0;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
  margin: 0;
  gap: 12px;
  min-height: 60px;
  line-height: 1.2;
}

.ps-a11y-profile-btn:hover {
  background: #f8faff;
  color: var(--ps-a11y-brand);
  z-index: 1;
  border-color: #d0e0ff;
}

.ps-a11y-profile-btn.active {
  background: var(--ps-a11y-active-profile-bg);
  color: var(--ps-a11y-active-profile-text);
  border-color: var(--ps-a11y-active-profile-text);
  box-shadow: inset 4px 0 0 var(--ps-a11y-active-profile-text);
  font-weight: 600;
}

.ps-a11y-profile-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: currentColor;
}

/* Extra Options */
.ps-a11y-extra-options {
  padding: 12px 16px;
  border-top: 1px solid var(--ps-a11y-border);
  background: #fff;
}

.ps-a11y-switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.ps-a11y-switch-row input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ps-a11y-slider {
  position: relative;
  cursor: pointer;
  width: 40px;
  height: 22px;
  background-color: #ccc;
  transition: .3s;
  border-radius: 34px;
}

.ps-a11y-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked+.ps-a11y-slider {
  background-color: var(--ps-a11y-brand);
}

input:checked+.ps-a11y-slider:before {
  transform: translateX(18px);
}

/* Pause Animations */
html.a11y-pause-animations * {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* Screen Reader Overlay */
.ps-a11y-sr-active {
  outline: 2px dashed #0b57d0 !important;
  outline-offset: 2px !important;
  background-color: rgba(11, 87, 208, 0.1) !important;
}

/* Text Align */
html[data-a11y-align="left"] body {
  text-align: left !important;
}

html[data-a11y-align="right"] body {
  text-align: right !important;
}

html[data-a11y-align="center"] body {
  text-align: center !important;
}

html[data-a11y-align="justify"] body {
  text-align: justify !important;
}

/* Level Indicators */
.ps-a11y-level-indicator {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  height: 4px;
  width: 60%;
  justify-content: center;
}

.ps-a11y-level-bar {
  flex: 1;
  background: #e0e0e0;
  border-radius: 2px;
}

.ps-a11y-level-bar.active {
  background: var(--ps-a11y-brand);
}

/* Accordion */
.ps-a11y-accordion {
  width: 100%;
}

.ps-a11y-accordion-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: #333;
  padding: 10px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ps-a11y-border);
  margin-bottom: 5px;
}

.ps-a11y-accordion-summary::-webkit-details-marker {
  display: none;
}

.ps-a11y-chevron {
  font-size: 10px;
  transition: transform 0.2s;
}

.ps-a11y-accordion[open] .ps-a11y-chevron {
  transform: rotate(180deg);
}

/* Position Options */
.ps-a11y-pos-options {
  display: flex;
  justify-content: center;
  gap: 16px;
  background: #fff;
  padding: 10px 0;
  border-top: 1px dashed #eee;
}

.ps-a11y-pos-opt {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ps-a11y-pos-opt input {
  opacity: 0;
  position: absolute;
}

.ps-a11y-pos-circle {
  width: 40px;
  height: 40px;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #999;
  transition: all 0.2s;
  background: #f9f9f9;
}

.ps-a11y-pos-opt:hover .ps-a11y-pos-circle {
  border-color: #bbb;
}

.ps-a11y-pos-opt input:checked+.ps-a11y-pos-circle {
  border-color: var(--ps-a11y-brand);
  background: var(--ps-a11y-active);
  color: var(--ps-a11y-brand);
  box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
}

.ps-a11y-pos-label {
  font-size: 10px;
  color: #666;
}

/* Reset */
.ps-a11y-footer-reset {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ps-a11y-border);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: #333;
  text-align: left;
  margin-bottom: 5px;
}

.ps-a11y-footer-reset:hover {
  background: #f0f0f0;
}

.ps-a11y-footer-reset svg {
  color: var(--ps-a11y-brand);
}

/* Tooltip */
.ps-a11y-tooltip-popup {
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  z-index: 2147483647;
  pointer-events: none;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: sans-serif;
  word-wrap: break-word;
}

.ps-a11y-tooltip-popup strong {
  color: #4fc3f7;
}