:root {
    --acc-bg: #ffffff;
    --acc-text: #333333;
    --acc-border: #cccccc;
    --acc-hover: #f0f0f0;
    --acc-active: #e0e0e0;
    --acc-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --acc-primary: #0056b3;
    --acc-zindex: 10000;
}

[data-theme="dark"] {
    --acc-bg: #333333;
    --acc-text: #ffffff;
    --acc-border: #555555;
    --acc-hover: #444444;
    --acc-active: #555555;
}

/* Floating Button */
#accessibility-toggle {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    /* LTR default, will adjust for RTL */
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--acc-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--acc-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--acc-zindex);
    transition: transform 0.2s;
    font-size: 1.5rem;
}

html[dir="rtl"] #accessibility-toggle {
    left: auto;
    right: 2rem;
}

#accessibility-toggle:hover {
    transform: scale(1.1);
}

#accessibility-toggle:focus-visible {
    outline: 3px solid var(--acc-primary);
    outline-offset: 2px;
}

/* Toolbar Menu */
#accessibility-toolbar {
    position: fixed;
    bottom: 6rem;
    left: 2rem;
    width: 300px;
    background: var(--acc-bg);
    border: 1px solid var(--acc-border);
    border-radius: 8px;
    box-shadow: var(--acc-shadow);
    padding: 1rem;
    z-index: var(--acc-zindex);
    display: none;
    flex-direction: column;
    gap: 1rem;
    font-family: sans-serif;
    color: var(--acc-text);
    max-height: 80vh;
    overflow-y: auto;
}

html[dir="rtl"] #accessibility-toolbar {
    left: auto;
    right: 2rem;
}

#accessibility-toolbar.visible {
    display: flex;
}

.acc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--acc-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.acc-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0;
}

.acc-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--acc-text);
}

.acc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.acc-btn {
    background: var(--acc-bg);
    border: 1px solid var(--acc-border);
    color: var(--acc-text);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.acc-btn:hover {
    background: var(--acc-hover);
}

.acc-btn.active {
    background: var(--acc-active);
    border-color: var(--acc-primary);
    color: var(--acc-primary);
    font-weight: bold;
}

.acc-btn-icon {
    font-size: 1.25rem;
}

.acc-reset {
    width: 100%;
    margin-top: 1rem;
    background: #dc3545;
    color: white;
    border: none;
}

.acc-reset:hover {
    background: #c82333;
}

/* Accessibility Modes */
html.acc-contrast {
    filter: contrast(150%);
}

html.acc-grayscale {
    filter: grayscale(100%);
}

html.acc-invert {
    filter: invert(100%);
}

html.acc-underline-links a {
    text-decoration: underline !important;
}

html.acc-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Font Sizing */
html.acc-fontsize-1 {
    font-size: 110%;
}

html.acc-fontsize-2 {
    font-size: 120%;
}

html.acc-fontsize-3 {
    font-size: 130%;
}

html.acc-fontsize-4 {
    font-size: 140%;
}

html.acc-fontsize-5 {
    font-size: 150%;
}

/* Cursor */
html.acc-cursor-big * {
    cursor: default !important;
    /* Placeholder for big cursor if needed, or just standard size increase */
}