:root {
  --a11y-z: 2147483000;
  --a11y-bg: #0f172a;
  --a11y-panel: #ffffff;
  --a11y-text: #111827;
  --a11y-muted: #6b7280;
  --a11y-border: #e5e7eb;
  --a11y-primary: #2563eb;
  --a11y-primary-soft: #eff6ff;
  --a11y-success-soft: #ecfdf5;
  --a11y-radius: 20px;
  --a11y-shadow: 0 24px 60px rgba(15, 23, 42, .18);
}

#a11y-widget-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--a11y-z);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

#a11y-widget-root *,
#a11y-widget-root *::before,
#a11y-widget-root *::after {
  box-sizing: border-box;
}

.a11y-skip-link {
  position: fixed;
  top: -60px;
  left: 20px;
  background: #000;
  color: #fff;
  padding: 12px 16px;
  z-index: calc(var(--a11y-z) + 1);
  border-radius: 10px;
  text-decoration: none;
  transition: top .2s ease;
}

.a11y-skip-link:focus { top: 20px; }

.a11y-trigger {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: var(--a11y-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.a11y-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.a11y-trigger:focus-visible,
.a11y-panel button:focus-visible,
.a11y-panel a:focus-visible,
.a11y-panel input:focus-visible,
.a11y-panel summary:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

.a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(2px);
}

.a11y-backdrop[hidden] { display: none; }

.a11y-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: min(430px, calc(100vw - 24px));
  max-height: min(84vh, 880px);
  background: var(--a11y-panel);
  color: var(--a11y-text);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 24px;
  box-shadow: var(--a11y-shadow);
  overflow: hidden;
  padding: 0;
}

.a11y-panel[hidden] { display: none; }

.a11y-header {
  padding: 20px 20px 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--a11y-border);
}

.a11y-header-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.a11y-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.a11y-header p {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--a11y-muted);
}

.a11y-close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--a11y-border);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.a11y-body {
  overflow: auto;
  max-height: calc(min(84vh, 880px) - 150px);
  padding: 18px;
  background: #f8fafc;
}

.a11y-section {
  margin-bottom: 18px;
}

.a11y-section-title {
  margin: 0 0 12px;
  font-size: 15px;
  color: #374151;
  font-weight: 700;
}

.a11y-preset-grid,
.a11y-slider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.a11y-toggle-list {
  display: grid;
  gap: 10px;
}

.a11y-tile,
.a11y-slider-card,
.a11y-note {
  border: 1px solid var(--a11y-border);
  border-radius: 18px;
  background: #fff;
}

.a11y-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.a11y-tile-icon,
.a11y-preset-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #111827;
  flex: 0 0 auto;
}

.a11y-tile-main {
  min-width: 0;
  flex: 1 1 auto;
}

.a11y-tile-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.a11y-tile-desc {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--a11y-muted);
  line-height: 1.35;
}

.a11y-switch {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: #d1d5db;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .2s ease;
}

.a11y-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .2s ease;
}

.a11y-switch[aria-pressed="true"] {
  background: var(--a11y-primary);
}

.a11y-switch[aria-pressed="true"]::after {
  transform: translateX(22px);
}

.a11y-preset {
  border: 1px solid var(--a11y-border);
  background: #fff;
  border-radius: 18px;
  cursor: pointer;
  padding: 14px;
  text-align: left;
  min-height: 96px;
}

.a11y-preset strong {
  display: block;
  margin-top: 10px;
  font-size: 15px;
}

.a11y-preset span {
  display: block;
  margin-top: 4px;
  color: var(--a11y-muted);
  font-size: 13px;
  line-height: 1.35;
}

.a11y-preset[aria-pressed="true"] {
  background: var(--a11y-primary-soft);
  border-color: #93c5fd;
}

.a11y-slider-card {
  padding: 14px;
}

.a11y-slider-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.a11y-slider-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.a11y-value {
  white-space: nowrap;
  font-size: 13px;
  color: var(--a11y-muted);
  font-weight: 700;
}

.a11y-range-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 10px;
  align-items: center;
}

.a11y-circle-btn,
.a11y-secondary-btn,
.a11y-primary-btn {
  border: 1px solid var(--a11y-border);
  background: #fff;
  color: var(--a11y-text);
  cursor: pointer;
}

.a11y-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
}

.a11y-range {
  width: 100%;
  accent-color: var(--a11y-primary);
}

.a11y-reset-inline {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--a11y-muted);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.a11y-note {
  padding: 14px 16px;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.5;
}

.a11y-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--a11y-border);
  background: #fff;
}

.a11y-secondary-btn,
.a11y-primary-btn {
  min-height: 52px;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
}

.a11y-primary-btn {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.a11y-secondary-btn:hover,
.a11y-primary-btn:hover,
.a11y-preset:hover,
.a11y-tile:hover,
.a11y-close:hover,
.a11y-circle-btn:hover {
  transform: translateY(-1px);
}

body.a11y-readable-font,
body.a11y-readable-font :not([class*="fa"]):not(i) {
  font-family: Arial, Helvetica, sans-serif !important;
}

body.a11y-underline-links a {
  text-decoration: underline !important;
  text-underline-offset: .15em;
}

html.a11y-grayscale { filter: grayscale(1); }
html.a11y-high-contrast { filter: contrast(1.25); }
html.a11y-invert { filter: invert(1) hue-rotate(180deg); }
body.a11y-hide-images img,
body.a11y-hide-images svg,
body.a11y-hide-images picture,
body.a11y-hide-images video,
body.a11y-hide-images [style*="background-image"] {
  visibility: hidden !important;
}
body.a11y-pause-animations *,
body.a11y-pause-animations *::before,
body.a11y-pause-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
body.a11y-highlight-focus :focus-visible {
  outline: 3px solid #ffbf47 !important;
  outline-offset: 3px !important;
}
body.a11y-big-cursor,
body.a11y-big-cursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='40' viewBox='0 0 30 40'%3E%3Cpath fill='black' stroke='white' stroke-width='2' d='M2 2l22 20H13l7 16-5 2-7-16-6 8z'/%3E%3C/svg%3E") 4 2, auto !important; }

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

@media (max-width: 640px) {
  #a11y-widget-root { right: 12px; bottom: 12px; }
  .a11y-panel {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 92px);
    border-radius: 22px;
  }
  .a11y-body { max-height: calc(100vh - 250px); }
  .a11y-preset-grid,
  .a11y-slider-grid,
  .a11y-footer { grid-template-columns: 1fr; }
  .a11y-trigger { width: 58px; height: 58px; }
}


/* Fixes: footer more spacious and sticky, buttons no longer clipped */
.a11y-panel {
  display: flex;
  flex-direction: column;
}

.a11y-body {
  flex: 1 1 auto;
  min-height: 0;
}

.a11y-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
}

.a11y-footer > * {
  width: 100%;
}

.a11y-secondary-btn,
.a11y-primary-btn {
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

@media (max-width: 640px) {
  .a11y-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 12px;
    max-height: calc(100vh - 24px);
  }

  .a11y-body {
    max-height: none;
    padding-bottom: 14px;
  }

  .a11y-footer {
    gap: 10px;
    padding: 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .a11y-secondary-btn,
  .a11y-primary-btn {
    min-height: 56px;
    font-size: 16px;
  }
}
