:root {
    --a11y-font-scale: 1;
}

html.a11y-text-110 {
    font-size: 110% !important;
}

html.a11y-text-120 {
    font-size: 120% !important;
}

html.a11y-text-130 {
    font-size: 130% !important;
}

html.a11y-text-140 {
    font-size: 140% !important;
}

html.a11y-text-150 {
    font-size: 150% !important;
}

html.a11y-grayscale {
    filter: grayscale(100%) !important;
}

html.a11y-invert {
    filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-stop-animations *,
html.a11y-stop-animations *::before,
html.a11y-stop-animations *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

body.a11y-readable-font,
body.a11y-readable-font * {
    font-family: Arial, 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif !important;
    letter-spacing: 0.03em !important;
    word-spacing: 0.08em !important;
    line-height: 1.75 !important;
}

body.a11y-highlight-links a,
body.a11y-highlight-links button,
body.a11y-highlight-links [role="button"] {
    outline: 3px solid #fbbf24 !important;
    outline-offset: 3px !important;
    text-decoration: underline 3px #fbbf24 !important;
}

body.a11y-high-contrast {
    background-color: #000000 !important;
    color: #ffff00 !important;
}

body.a11y-high-contrast * {
    background-color: transparent !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.a11y-high-contrast a,
body.a11y-high-contrast button,
body.a11y-high-contrast .btn,
body.a11y-high-contrast [role="button"] {
    background-color: #000000 !important;
    color: #00ffff !important;
    border: 2px solid #00ffff !important;
}

body.a11y-high-contrast a:hover,
body.a11y-high-contrast button:hover {
    background-color: #00ffff !important;
    color: #000000 !important;
}

body.a11y-big-cursor,
body.a11y-big-cursor * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><polygon points='0,0 0,38 10,28 18,46 25,43 17,25 30,25' fill='%23000000' stroke='%23ffffff' stroke-width='3'/></svg>"), auto !important;
}

#a11y-trigger {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 999990;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s, background 0.2s;
    outline: none;
}

#a11y-trigger:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.6), 0 0 0 2px #a855f7;
}

#a11y-trigger:focus-visible {
    outline: 4px solid #38bdf8;
    outline-offset: 4px;
}

#a11y-trigger svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

#a11y-panel {
    position: fixed;
    bottom: 84px;
    left: 22px;
    z-index: 999991;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 110px);
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    color: #f8fafc;
    direction: rtl;
    text-align: right;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;
    animation: a11ySlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#a11y-panel.active {
    display: flex;
}

@keyframes a11ySlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.a11y-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
}

.a11y-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    background: #4f46e5;
    color: #ffffff;
}

.a11y-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.a11y-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.a11y-close-btn:focus-visible {
    outline: 2px solid #38bdf8;
}

.a11y-content {
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.a11y-content::-webkit-scrollbar {
    width: 6px;
}

.a11y-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.a11y-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.a11y-font-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px;
    gap: 6px;
}

.a11y-step-btn {
    flex: 1;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.a11y-step-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.a11y-step-btn:focus-visible {
    outline: 2px solid #38bdf8;
}

.a11y-step-val {
    font-size: 13px;
    font-weight: 800;
    color: #38bdf8;
    padding: 0 8px;
    min-width: 50px;
    text-align: center;
}

.a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 8px;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    outline: none;
    text-align: center;
}

.a11y-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.a11y-toggle-btn:focus-visible {
    outline: 2px solid #38bdf8;
}

.a11y-toggle-btn.active {
    background: rgba(79, 70, 229, 0.35);
    border-color: #818cf8;
    color: #ffffff;
    box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.3);
}

.a11y-toggle-btn .a11y-btn-icon {
    font-size: 20px;
    line-height: 1;
}

.a11y-toggle-btn .a11y-btn-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
}

.a11y-footer {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.a11y-btn-reset {
    width: 100%;
    padding: 8px;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.a11y-btn-reset:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

.a11y-btn-statement {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-align: center;
    padding: 4px;
}

.a11y-btn-statement:hover {
    color: #ffffff;
}

#a11y-reading-ruler {
    position: fixed;
    left: 0;
    right: 0;
    height: 38px;
    background: rgba(251, 191, 36, 0.18);
    border-top: 2px solid #fbbf24;
    border-bottom: 2px solid #fbbf24;
    pointer-events: none;
    z-index: 999980;
    display: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

#a11y-statement-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999995;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    direction: rtl;
}

#a11y-statement-modal.active {
    display: flex;
}

.a11y-statement-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f1f5f9;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.a11y-statement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.a11y-statement-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.a11y-statement-body h3 {
    font-size: 16px;
    color: #fbbf24;
    margin-top: 8px;
}

.a11y-statement-body ul {
    padding-right: 20px;
}

.a11y-statement-body li {
    margin-bottom: 6px;
}

@media (max-width: 600px) {
    #a11y-trigger {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
    }

    #a11y-panel {
        left: 12px;
        right: 12px;
        bottom: 74px;
        width: auto;
        max-width: none;
    }
}
