﻿:root {
    --aw-panel-width: 380px;
    --aw-accent-color: #2563eb;
    --aw-accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
}

.accessibility-widget {
    position: fixed !important;
    bottom: 80px !important;
    right: 24px !important;
    top: auto !important;
    z-index: 2147483647 !important;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
    color: #0f172a !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
    /* Isolate from page adjustments */
    font-size: 16px !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    text-align: left !important;
}

.accessibility-toggle {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 2147483647 !important;
    transition: transform 0.3s ease !important;
    box-shadow: none !important;
}

.accessibility-toggle:hover {
    transform: scale(1.1) !important;
}

/* Hide text content except for AC label */
.accessibility-toggle .aw-label,
.accessibility-toggle span:not(.aw-ac-text) {
    display: none !important;
}

.aw-ac-text {
    display: block !important;
    font-family: sans-serif !important;
    line-height: 1 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 22px !important; /* Fixed px size */
    z-index: 2147483648 !important;
    position: relative !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .accessibility-widget {
        bottom: 20px !important;
        right: 16px !important;
    }
    
    .accessibility-toggle {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }
    
    .accessibility-toggle .accessibility-icon {
        width: 48px !important;
        height: 48px !important;
    }
    
    .accessibility-panel {
        right: 16px !important;
        left: 16px !important;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
        bottom: 80px !important;
    }
}

@media (max-width: 480px) {
    .accessibility-widget {
        bottom: 16px !important;
        right: 12px !important;
    }
    
    .accessibility-toggle {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    .accessibility-toggle .accessibility-icon {
        width: 44px !important;
        height: 44px !important;
    }
    
    .accessibility-panel {
        right: 12px !important;
        left: 12px !important;
        bottom: 70px !important;
        max-height: calc(100vh - 100px) !important;
        padding: 16px !important; /* Fixed px padding */
    }
    
    .aw-ac-text {
        font-size: 18px !important; /* Fixed px size */
    }
}

.accessibility-toggle:focus-visible {
    outline: 3px solid #fcd34d;
    outline-offset: 4px;
}

.accessibility-panel {
    position: fixed !important;
    bottom: 150px !important;
    right: 24px !important;
    top: auto !important;
    width: var(--aw-panel-width) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 180px) !important;
    background: #fff !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 65px rgba(15, 23, 42, 0.25) !important;
    padding: 28px !important; /* Fixed px padding */
    opacity: 0 !important;
    transform: translateY(20px) !important;
    pointer-events: none !important;
    transition: opacity .3s ease, transform .3s ease !important;
    z-index: 2147483646 !important;
    visibility: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    /* Isolate text styles */
    font-size: 16px !important;
    line-height: 1.5 !important;
}

.accessibility-widget.is-open .accessibility-panel {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.accessibility-widget.is-open .accessibility-toggle {
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.6) !important;
}

.accessibility-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.accessibility-panel h3 {
    font-size: 22px;
    margin: 0;
    font-weight: 700;
}

.accessibility-panel .aw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.accessibility-panel .aw-pill {
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.accessibility-panel .aw-pill:hover,
.accessibility-panel .aw-pill:focus-visible {
    background: #e0e7ff;
    outline: none;
}

.aw-close-btn {
    border: none;
    background: #eff1f7;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
}

.aw-search {
    margin-bottom: 1.25rem;
}

.aw-search input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #d6d9e8;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}

.aw-section + .aw-section {
    margin-top: 1.5rem;
}

.aw-section h5 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.9rem;
    font-weight: 700;
}

.aw-profile-grid,
.aw-control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.aw-toggle-card,
.aw-control-card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 0.9rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 90px;
}

.aw-toggle-card strong {
    font-size: 0.95rem;
}

.aw-switch {
    margin-top: auto;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    padding: 0.35rem 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fff;
    color: #475569;
}

.aw-switch .state {
    font-weight: 700;
    color: #475569;
}

.aw-switch.is-active {
    background: var(--aw-accent-gradient);
    color: #fff;
    border-color: transparent;
}

.aw-switch.is-active .state {
    color: #fff;
}

.aw-slider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.aw-slider input[type=range] {
    flex: 1;
}

.aw-slider span {
    font-weight: 600;
    color: #2563eb;
    min-width: 48px;
    text-align: right;
}

.aw-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.aw-chip {
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.aw-chip.is-active {
    background: var(--aw-accent-gradient);
    color: #fff;
    border-color: transparent;
}

.aw-color-swatches {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.aw-color {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
    cursor: pointer;
}

.aw-hidden {
    display: none !important;
}

#aw-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 60px;
    pointer-events: none;
    background: rgba(37, 99, 235, 0.1);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.3);
    z-index: 2147483641;
    opacity: 0;
    transition: opacity .15s ease;
}

body.aw-reading-guide #aw-reading-guide {
    opacity: 1;
}

/* Adjustment classes */
body.aw-readable-font {
    font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif !important;
}

body.aw-highlight-links a {
    outline: 2px dashed #f97316 !important;
    outline-offset: 4px;
    background-color: rgba(249, 115, 22, 0.08);
}

body.aw-highlight-titles h1,
body.aw-highlight-titles h2,
body.aw-highlight-titles h3,
body.aw-highlight-titles h4 {
    background: #fef3c7;
    display: inline-block;
    padding: 0.1em 0.35em;
    border-radius: 0.4rem;
}

body.aw-text-magnifier p:hover,
body.aw-text-magnifier li:hover,
body.aw-text-magnifier span:hover {
    transform: scale(1.02);
    transition: transform 0.15s ease, background 0.15s ease;
    background: rgba(37, 99, 235, 0.08);
}

body.aw-highlight-focus :focus {
    outline: 3px solid #f97316 !important;
    outline-offset: 4px !important;
}

body.aw-hide-images img {
    opacity: 0.08 !important;
    filter: grayscale(1);
}

body.aw-read-mode {
    background: #fdf8e7 !important;
    color: #0f172a;
}

body.aw-stop-animations *,
body.aw-stop-animations *::before,
body.aw-stop-animations *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

body.aw-reduce-motion {
    scroll-behavior: auto !important;
}

body.aw-reduce-motion *,
body.aw-reduce-motion *::before,
body.aw-reduce-motion *::after {
    animation-duration: 0.01s !important;
}

body.aw-high-contrast > :not(.accessibility-widget) {
    filter: contrast(1.35) saturate(1.1);
}

body.aw-dark-contrast {
    background: #000;
}
body.aw-dark-contrast > :not(.accessibility-widget) {
    filter: invert(1) hue-rotate(180deg);
}

body.aw-light-contrast > :not(.accessibility-widget) {
    filter: brightness(1.15);
}

body.aw-monochrome > :not(.accessibility-widget) {
    filter: grayscale(1);
}

body.aw-high-saturation > :not(.accessibility-widget) {
    filter: saturate(1.6);
}

body.aw-low-saturation > :not(.accessibility-widget) {
    filter: saturate(0.4);
}

body.aw-highlight-hover *:hover {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

body.aw-custom-text-color,
body.aw-custom-text-color p,
body.aw-custom-text-color li,
body.aw-custom-text-color span {
    color: var(--aw-custom-text-color, inherit) !important;
}

body.aw-custom-title-color h1,
body.aw-custom-title-color h2,
body.aw-custom-title-color h3,
body.aw-custom-title-color h4,
body.aw-custom-title-color h5,
body.aw-custom-title-color h6 {
    color: var(--aw-custom-title-color, inherit) !important;
}

body.aw-custom-bg-color {
    background-color: var(--aw-custom-bg-color, #fff) !important;
}

body.aw-reading-mask::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    pointer-events: none;
    z-index: 2147483635;
}

body.aw-reading-mask::after {
    content: "";
    position: fixed;
    inset: calc(50% - 120px) 5% calc(50% - 120px);
    border-radius: 24px;
    background: transparent;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.65);
    pointer-events: none;
    z-index: 2147483636;
}

.aw-warning {
    font-size: 0.8rem;
    color: #475569;
}

.aw-profile-grid .aw-switch {
    justify-content: center;
}

.aw-footer-note {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

.aw-profile-grid button {
    width: 100%;
}

.aw-color-cancel {
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    text-decoration: underline;
}

.aw-profile-grid .aw-toggle-card {
    min-height: 120px;
}

.aw-profile-grid .aw-toggle-card p {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
}

.aw-profile-grid .aw-toggle-card .aw-switch {
    margin-top: 0.6rem;
}

.aw-profile-grid .aw-toggle-card i {
    font-size: 1.25rem;
    color: #2563eb;
}

.aw-toggle-card small {
    color: #94a3b8;
}

body.aw-big-black-cursor,
body.aw-big-black-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23000000'/%3E%3C/svg%3E") 4 4, auto !important;
}

body.aw-big-white-cursor,
body.aw-big-white-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23ffffff' stroke='%23000000' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

@media (max-width: 640px) {
    .accessibility-widget {
        bottom: 16px !important;
        right: 16px !important;
    }
    
    .accessibility-panel {
        right: 16px !important;
        left: 16px !important;
        width: auto !important;
        bottom: 80px !important;
        max-height: calc(100vh - 110px) !important;
    }

    .accessibility-widget.is-open .accessibility-panel {
        transform: translateY(0) !important;
    }
}

/* Force visibility - highest priority rules */
body .accessibility-widget,
html .accessibility-widget,
.accessibility-widget,
#accessibility-widget-root {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}

body .accessibility-widget .accessibility-toggle,
html .accessibility-widget .accessibility-toggle,
.accessibility-widget .accessibility-toggle {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4) !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Ensure the AC text is absolutely visible */
body .aw-ac-text,
html .aw-ac-text,
.aw-ac-text,
.accessibility-toggle .aw-ac-text {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #ffffff !important;
    font-family: sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.4rem !important;
    line-height: 1 !important;
    z-index: 2147483648 !important;
    position: relative !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure it's always on top */
body.aw-* .accessibility-widget,
.accessibility-widget[data-widget="accessibility"] {
    display: flex !important;
    visibility: visible !important;
    z-index: 2147483647 !important;
}