/*
 * Accessibility Tools 1.1.0 — moduł bez AI
 * Wszystkie selektory interfejsu są ograniczone prefiksem .atools-.
 */

:root {
    --atools-bottom-offset: 16px;
    --atools-font-size: 16px;
}

.atools-widget,
.atools-widget * {
    box-sizing: border-box;
}

.atools-widget {
    --atools-accent: #5b2e60;
    --atools-accent-hover: #442149;
    --atools-accent-soft: #f5eef6;
    --atools-border: #d9d3dc;
    --atools-text: #201b22;
    --atools-muted: #625b65;
    --atools-surface: #ffffff;
    --atools-focus: #ffbf47;
    position: relative;
    z-index: 2147483000;
    color: var(--atools-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.atools-widget [hidden] {
    display: none !important;
}

.atools-launcher {
    position: fixed;
    right: 16px;
    bottom: var(--atools-bottom-offset);
    z-index: 2147483001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--atools-accent);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(31, 21, 34, 0.26);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.atools-launcher:hover {
    background: var(--atools-accent-hover);
}

.atools-launcher:focus-visible,
.atools-widget button:focus-visible,
.atools-widget input:focus-visible {
    outline: 3px solid var(--atools-focus);
    outline-offset: 3px;
}

.atools-launcher__icon {
    flex: 0 0 auto;
}

.atools-panel {
    position: fixed;
    right: 16px;
    bottom: calc(var(--atools-bottom-offset) + 62px);
    z-index: 2147483002;
    width: min(420px, calc(100vw - 32px));
    max-height: min(720px, calc(100vh - var(--atools-bottom-offset) - 86px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
    border: 1px solid var(--atools-border);
    border-radius: 18px;
    background: var(--atools-surface);
    color: var(--atools-text);
    box-shadow: 0 18px 50px rgba(28, 20, 31, 0.28);
}

.atools-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.atools-panel__eyebrow {
    margin: 0 0 3px;
    color: var(--atools-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.3;
    text-transform: uppercase;
}

.atools-panel__title {
    margin: 0;
    color: var(--atools-text);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
}

.atools-icon-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--atools-border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--atools-text);
    cursor: pointer;
}

.atools-icon-button:hover {
    background: #f4f2f4;
}

.atools-panel__intro {
    margin: 14px 0 18px;
    color: var(--atools-muted);
    font-size: 0.94rem;
    line-height: 1.55;
}

.atools-options {
    display: grid;
    gap: 10px;
}

.atools-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 68px;
    padding: 12px 14px;
    border: 1px solid var(--atools-border);
    border-radius: 13px;
    background: #ffffff;
    color: var(--atools-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.atools-option:hover {
    border-color: var(--atools-accent);
    background: var(--atools-accent-soft);
}

.atools-option[aria-checked="true"],
.atools-option[aria-pressed="true"] {
    border-color: var(--atools-accent);
    background: var(--atools-accent-soft);
}

.atools-option:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.atools-option__content {
    display: grid;
    gap: 2px;
}

.atools-option__content strong {
    color: var(--atools-text);
    font-size: 1rem;
    line-height: 1.35;
}

.atools-option__content span {
    color: var(--atools-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.atools-option__action-icon {
    flex: 0 0 auto;
    color: var(--atools-accent);
}

.atools-switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border: 2px solid #7b737d;
    border-radius: 999px;
    background: #ffffff;
}

.atools-switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #5b535d;
    transition: transform 160ms ease, background-color 160ms ease;
}

.atools-option[aria-checked="true"] .atools-switch {
    border-color: var(--atools-accent);
    background: var(--atools-accent);
}

.atools-option[aria-checked="true"] .atools-switch span {
    background: #ffffff;
    transform: translateX(20px);
}

.atools-fieldset {
    min-width: 0;
    margin: 18px 0 0;
    padding: 14px;
    border: 1px solid var(--atools-border);
    border-radius: 13px;
}

.atools-fieldset legend,
.atools-section h3 {
    padding: 0 5px;
    color: var(--atools-text);
    font-size: 0.95rem;
    font-weight: 800;
}

.atools-font-control {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 10px;
}

.atools-font-button {
    min-width: 44px;
    min-height: 44px;
    padding: 5px;
    border: 1px solid var(--atools-border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--atools-text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.atools-font-button:hover {
    border-color: var(--atools-accent);
    background: var(--atools-accent-soft);
}

.atools-font-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.atools-range-wrap {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.atools-range-wrap input[type="range"] {
    width: 100%;
    accent-color: var(--atools-accent);
    cursor: pointer;
}

.atools-range-wrap output {
    color: var(--atools-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

.atools-section {
    margin-top: 18px;
}

.atools-section h3 {
    margin: 0 0 8px;
    padding: 0;
}

.atools-panel__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--atools-border);
}

.atools-reset {
    min-height: 44px;
    padding: 9px 14px;
    border: 2px solid var(--atools-accent);
    border-radius: 10px;
    background: #ffffff;
    color: var(--atools-accent);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.atools-reset:hover {
    background: var(--atools-accent);
    color: #ffffff;
}

.atools-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Ustawienia dotyczące właściwej strony, a nie interfejsu modułu. */
html.atools-font-size-active {
    font-size: var(--atools-font-size) !important;
}

html.atools-reading-mode body {
    font-family: Arial, Verdana, Tahoma, sans-serif !important;
}

html.atools-reading-mode main,
html.atools-reading-mode [role="main"] {
    text-rendering: optimizeLegibility;
}

html.atools-reading-mode main p,
html.atools-reading-mode main li,
html.atools-reading-mode main dd,
html.atools-reading-mode main blockquote,
html.atools-reading-mode [role="main"] p,
html.atools-reading-mode [role="main"] li,
html.atools-reading-mode [role="main"] dd,
html.atools-reading-mode [role="main"] blockquote {
    line-height: 1.8 !important;
    letter-spacing: 0.018em !important;
    word-spacing: 0.055em !important;
}

html.atools-reading-mode main p,
html.atools-reading-mode [role="main"] p {
    max-width: 76ch;
}

html.atools-reading-mode main a,
html.atools-reading-mode [role="main"] a {
    text-decoration-line: underline !important;
    text-decoration-thickness: 0.13em !important;
    text-underline-offset: 0.2em !important;
}

html.atools-reduce-motion {
    scroll-behavior: auto !important;
}

html.atools-reduce-motion *,
html.atools-reduce-motion *::before,
html.atools-reduce-motion *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
}


/* Podświetlenie fragmentu aktualnie odczytywanego przez Web Speech API. */
html.atools-speech-active .atools-speaking-section {
    position: relative;
    z-index: 1;
    scroll-margin-block: 96px 130px;
    border-radius: 6px;
    outline: 3px solid #5b2e60 !important;
    outline-offset: 4px;
    background-color: #fff3b0 !important;
    box-shadow: 0 0 0 6px rgba(255, 243, 176, 0.72);
    color: #201b22 !important;
    transition: background-color 160ms ease, outline-color 160ms ease, box-shadow 160ms ease;
}

html.atools-speech-active .atools-speaking-section :where(span, strong, em, b, i, small, code, a),
html.atools-speech-active tr.atools-speaking-section > th,
html.atools-speech-active tr.atools-speaking-section > td,
html.atools-speech-active tr.atools-speaking-section > th *,
html.atools-speech-active tr.atools-speaking-section > td * {
    color: #201b22 !important;
}

html.atools-speech-active tr.atools-speaking-section > th,
html.atools-speech-active tr.atools-speaking-section > td {
    background-color: #fff3b0 !important;
}

html.atools-reduce-motion .atools-speaking-section {
    transition: none !important;
}

@media (max-width: 520px) {
    .atools-launcher {
        right: 10px;
        bottom: var(--atools-bottom-offset);
        max-width: calc(100vw - 20px);
        padding-inline: 14px;
    }

    .atools-panel {
        right: 10px;
        bottom: calc(var(--atools-bottom-offset) + 60px);
        width: calc(100vw - 20px);
        max-height: calc(100vh - var(--atools-bottom-offset) - 82px);
        padding: 16px;
        border-radius: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .atools-switch span {
        transition: none;
    }
}

@media print {
    .atools-widget {
        display: none !important;
    }
}

@media (forced-colors: active) {
    .atools-launcher,
    .atools-panel,
    .atools-option,
    .atools-icon-button,
    .atools-font-button,
    .atools-reset,
    .atools-switch,
    .atools-speaking-section {
        forced-color-adjust: auto;
    }

    html.atools-speech-active .atools-speaking-section {
        outline-color: Highlight !important;
        background: Highlight !important;
        color: HighlightText !important;
        box-shadow: none;
    }
}
