/* ===== Accessibility widget (floating button + panel) =====
   Bottom corners are taken (bug-report FAB inline-start, co-op emoji bar left),
   so the widget anchors to the vertical middle of the inline-end edge. */

.a11y-fab {
    position: fixed;
    top: 50%;
    inset-inline-end: 0;
    transform: translateY(-50%);
    z-index: 2147482998; /* just below the bug-report FAB/modal */
    width: 46px;
    height: 46px;
    border: 2px solid #fff;
    border-inline-end: none;
    border-start-start-radius: 12px;
    border-end-start-radius: 12px;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    background: #1d4ed8;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

.a11y-fab:hover { background: #1e40af; }

.a11y-fab:focus-visible,
.a11y-panel button:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 2px;
}

.a11y-panel {
    position: fixed;
    top: 50%;
    inset-inline-end: 54px;
    transform: translateY(-50%);
    z-index: 2147482999;
    width: 300px;
    max-width: calc(100vw - 70px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: #fff;
    color: #111827;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
    padding: 14px;
    direction: rtl;
    font-family: 'Heebo', Arial, sans-serif;
}

.a11y-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.a11y-panel__title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.a11y-panel__x {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    font-size: 1rem;
    cursor: pointer;
}

.a11y-panel__x:hover { background: #e5e7eb; }

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

.a11y-row__label { font-weight: 700; font-size: .9rem; }

.a11y-size { display: flex; align-items: center; gap: 8px; }

.a11y-size__btn {
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

.a11y-size__btn:hover { background: #eef2ff; }

.a11y-size__val {
    min-width: 48px;
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

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

.a11y-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #111827;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.a11y-opt:hover { background: #eef2ff; }

.a11y-opt[aria-pressed="true"] {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.a11y-opt__icon { font-size: 1.15rem; line-height: 1; }

.a11y-reset {
    width: 100%;
    padding: 10px;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 800;
    cursor: pointer;
}

.a11y-reset:hover { background: #fee2e2; }

.a11y-statement-link {
    display: block;
    margin-top: 10px;
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    color: #1d4ed8;
    text-decoration: underline;
}

/* Visually hidden but announced by screen readers (aria-live region) */
.a11y-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Global effects driven by classes on <html> ===== */

/* Display size — zoom scales px-based game UIs too, unlike rem-only font scaling */
html.a11y-zoom body { zoom: var(--a11y-font-scale, 1); }

/* Link highlighting */
html.a11y-links a,
html.a11y-links a * {
    text-decoration: underline !important;
    background-color: #fde047 !important;
    color: #1e3a8a !important;
}

/* Readable font */
html.a11y-readable body,
html.a11y-readable body * {
    font-family: Arial, 'Segoe UI', sans-serif !important;
    letter-spacing: .01em;
}

/* Stop animations & transitions */
html.a11y-no-motion *,
html.a11y-no-motion *::before,
html.a11y-no-motion *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* Big cursor (48px arrow, white fill + black outline) */
html.a11y-cursor,
html.a11y-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M5 2l14 12h-8l-3 8z" fill="white" stroke="black" stroke-width="1.5"/></svg>') 4 2, auto !important;
}

/* Strong visible focus everywhere */
html.a11y-focus *:focus {
    outline: 4px solid #dc2626 !important;
    outline-offset: 2px !important;
}
