:root {
  --hd-a11y-scale: 1;
  --hd-a11y-color-1: #172554;
  --hd-a11y-color-2: #4c1d95;
  --hd-a11y-color-3: #030712;
  --hd-a11y-color-4: #f8fafc;
  --hd-a11y-intensity: 0.42;
}

html.hd-a11y-scaled { font-size: calc(16px * var(--hd-a11y-scale)); }

html.hd-a11y-scaled .btn,
html.hd-a11y-scaled .input,
html.hd-a11y-scaled .select,
html.hd-a11y-scaled .textarea,
html.hd-a11y-scaled button:not(.hd-a11y-close):not(.hd-a11y-launch) {
  min-height: calc(36px * var(--hd-a11y-scale));
}

body.hd-a11y-custom-background {
  background: linear-gradient(135deg, var(--hd-a11y-color-1), var(--hd-a11y-color-2), var(--hd-a11y-color-3), var(--hd-a11y-color-4)) !important;
  background-attachment: fixed !important;
  background-size: 220% 220% !important;
}

body.hd-a11y-custom-fields :is(.card, .panel, .section-card, .stat-card, .server-card, .filter-bar, .login-card, .sidebar-card, .settings-card, .data-card, .action-card, .template-card, .bot-card) {
  background: linear-gradient(145deg, var(--hd-a11y-field-color-1), var(--hd-a11y-field-color-2), var(--hd-a11y-field-color-3), var(--hd-a11y-field-color-4)) !important;
}

body.hd-a11y-custom-categories :is(#mainSidebar, .app-shell > .sidebar, body > .sidebar) {
  background: linear-gradient(180deg, var(--hd-a11y-category-color-1), var(--hd-a11y-category-color-2), var(--hd-a11y-category-color-3), var(--hd-a11y-category-color-4)) !important;
}

body.hd-a11y-custom-categories :is(.nav-category-header, .sidebar .nav-item, .sidebar-nav .nav-item, .sidebar-footer) {
  background-color: var(--hd-a11y-category-color-2) !important;
}

.cookie-legal-footer .hd-a11y-launch,
.login-policy-links .hd-a11y-launch {
  flex: 0 0 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin-top: 10px;
  padding: 13px 20px;
  border: 1px solid rgba(196, 181, 253, 0.46);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.95), rgba(30, 64, 175, 0.9));
  box-shadow: 0 12px 28px rgba(76, 29, 149, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font: 700 0.95rem "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.cookie-legal-footer .hd-a11y-launch:hover,
.login-policy-links .hd-a11y-launch:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 16px 34px rgba(76, 29, 149, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hd-a11y-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.76);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.hd-a11y-backdrop.is-open { opacity: 1; pointer-events: auto; }

.hd-a11y-modal {
  width: min(720px, 100%);
  max-height: min(820px, calc(100dvh - 40px));
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: linear-gradient(145deg, #192238, #0c1220);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
  color: #f8fafc;
  transform: translateY(14px) scale(0.985);
  transition: transform 180ms ease;
}

.hd-a11y-backdrop.is-open .hd-a11y-modal { transform: translateY(0) scale(1); }
.hd-a11y-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
.hd-a11y-modal-header h2 { margin: 0 0 6px; font: 700 1.15rem "Segoe UI", sans-serif; color: #fff; }
.hd-a11y-modal-header p { margin: 0; color: #b7c2d4; font: 0.9rem/1.5 "Segoe UI", sans-serif; }
.hd-a11y-close { width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: #f8fafc; font-size: 1.4rem; cursor: pointer; }
.hd-a11y-close:hover { background: rgba(148, 163, 184, 0.14); }
.hd-a11y-body { padding: 18px 22px 22px; }
.hd-a11y-section { padding: 16px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.16); }
.hd-a11y-section:last-child { border-bottom: 0; }
.hd-a11y-section h3 { margin: 0 0 6px; color: #f8fafc; font: 700 0.98rem "Segoe UI", sans-serif; }
.hd-a11y-section p { margin: 0; color: #b7c2d4; font: 0.87rem/1.5 "Segoe UI", sans-serif; }
.hd-a11y-default { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid rgba(74, 222, 128, 0.45); border-radius: 6px; background: rgba(34, 197, 94, 0.1); color: #dcfce7; font: 700 0.92rem "Segoe UI", sans-serif; text-align: left; cursor: pointer; }
.hd-a11y-default:hover { background: rgba(34, 197, 94, 0.18); }
.hd-a11y-color-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.hd-a11y-color-control { display: grid; gap: 7px; color: #dbe4f2; font: 0.8rem "Segoe UI", sans-serif; }
.hd-a11y-color-control input { width: 100%; height: 42px; padding: 3px; border: 1px solid rgba(148, 163, 184, 0.32); border-radius: 6px; background: #0f172a; cursor: pointer; }
.hd-a11y-range-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; margin-top: 14px; }
.hd-a11y-range-row input { width: 100%; accent-color: #a78bfa; }
.hd-a11y-range-value { min-width: 48px; color: #ddd6fe; font: 700 0.84rem "Segoe UI", sans-serif; text-align: right; }
.hd-a11y-scale-labels { display: flex; justify-content: space-between; margin-top: 4px; color: #94a3b8; font: 0.75rem "Segoe UI", sans-serif; }
.hd-a11y-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid rgba(148, 163, 184, 0.2); }
.hd-a11y-save { min-height: 40px; padding: 9px 14px; border: 0; border-radius: 6px; background: linear-gradient(135deg, #8b5cf6, #5b21b6); color: #fff; font: 700 0.86rem "Segoe UI", sans-serif; cursor: pointer; }
.hd-a11y-save:hover { filter: brightness(1.08); }
.hd-a11y-launch:focus-visible, .hd-a11y-close:focus-visible, .hd-a11y-default:focus-visible, .hd-a11y-save:focus-visible, .hd-a11y-color-control input:focus-visible, .hd-a11y-range-row input:focus-visible { outline: 3px solid rgba(196, 181, 253, 0.82); outline-offset: 2px; }

@media (max-width: 900px) {
  .hd-a11y-backdrop { padding: 12px; align-items: end; }
  .hd-a11y-modal { max-height: min(760px, calc(100dvh - 24px)); }
}

@media (max-width: 600px) {
  .cookie-legal-footer .hd-a11y-launch,
  .login-policy-links .hd-a11y-launch { min-height: 54px; margin-top: 8px; }
  .hd-a11y-modal-header, .hd-a11y-body, .hd-a11y-footer { padding-left: 16px; padding-right: 16px; }
  .hd-a11y-color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-a11y-footer { display: grid; grid-template-columns: 1fr; }
  .hd-a11y-save { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hd-a11y-backdrop, .hd-a11y-modal, .hd-a11y-launch { transition: none; }
}
