/* ============================================
   Accessibilité Mairie RGAA — Widget v1.4.0
   FIX: filters applied to #amr-content-wrap
   instead of body to preserve position:fixed
   ============================================ */

/* === Content wrapper (injected by JS) === */
#amr-content-wrap {
    min-height: 100vh;
    position: relative;
}

/* === Trigger button === */
.amr-a11y-trigger {
    position: fixed; bottom: 20px;
    z-index: 2147483646;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--amr-widget-color, #000091);
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: transform .2s, box-shadow .2s;
    padding: 0; line-height: 1;
}
.amr-a11y-trigger:focus-visible { outline: 3px solid #ffcc00; outline-offset: 3px; }
.amr-a11y-trigger svg { width: 55%; height: 55%; fill: currentColor; }
.amr-a11y-trigger img { width: 60%; height: 60%; object-fit: contain; border-radius: 3px; }
.amr-trigger-badge {
    position: absolute; top: -2px; right: -2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #ce614a; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

/* === Panel === */
.amr-a11y-panel {
    position: fixed !important; bottom: 0;
    z-index: 2147483647;
    width: 380px; max-height: 90vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,.15);
    display: none; flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px; color: #1e1e1e;
    overflow: hidden;
    animation: amr-slide-up .3s ease;
}
.amr-a11y-panel.open { display: flex; }
@keyframes amr-slide-up { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Panel header */
.amr-a11y-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; color: #fff; flex-shrink: 0;
}
.amr-a11y-panel-header h2 {
    margin: 0; font-size: 15px; font-weight: 700;
    display: flex; align-items: center; gap: 8px; color: #fff;
}
.amr-a11y-panel-header h2 svg { width: 20px; height: 20px; fill: currentColor; }
.amr-a11y-header-actions { display: flex; gap: 6px; }
.amr-a11y-header-btn {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
    transition: background .2s; font-weight: 500;
}
.amr-a11y-header-btn:hover { background: rgba(255,255,255,.3); }
.amr-a11y-close {
    background: none; border: none; color: #fff; cursor: pointer;
    padding: 4px; border-radius: 4px; line-height: 1; font-size: 22px;
}
.amr-a11y-close:hover { background: rgba(255,255,255,.2); }

/* Panel body */
.amr-a11y-panel-body { overflow-y: auto; padding: 14px 18px; flex: 1; overscroll-behavior: contain; }

/* ===================================================================
   PROFILE CARDS
   =================================================================== */
.amr-profiles {
    margin-bottom: 16px; padding-bottom: 14px;
    border-bottom: 1px solid #e8e8e8;
}
.amr-profiles-label {
    font-size: 12px; font-weight: 600; color: #777; text-transform: uppercase;
    letter-spacing: .05em; margin-bottom: 10px;
}
.amr-profiles-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.amr-profile-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 10px 4px; border-radius: 10px;
    border: 2px solid #e8e8e8; background: #fafafa;
    cursor: pointer; transition: all .2s;
    font-family: inherit;
}
.amr-profile-card:hover {
    border-color: #b0b0b0; background: #f0f0f0; transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.08);
}
.amr-profile-card.active {
    border-color: #000091; background: #eef0ff;
    box-shadow: 0 0 0 2px rgba(0,0,145,.15);
}
.amr-profile-card.active .amr-profile-name { color: #000091; font-weight: 700; }
.amr-profile-icon { font-size: 22px; line-height: 1; }
.amr-profile-name { font-size: 11px; font-weight: 600; color: #555; line-height: 1.1; }

/* Sections — collapsible accordion */
.amr-a11y-section { margin-bottom: 6px; border: 1px solid #e5e5e5; border-radius: 10px; overflow: hidden; }
.amr-a11y-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; cursor: pointer; user-select: none;
    background: #f6f6f6; transition: background .15s;
}
.amr-a11y-section-header:hover { background: #eee; }
.amr-a11y-section-title {
    font-size: 13px; font-weight: 700;
    color: #3a3a3a;
}
.amr-a11y-section-arrow {
    font-size: 14px; color: #929292; transition: transform .2s;
}
.amr-a11y-section.collapsed .amr-a11y-section-arrow { transform: rotate(-90deg); }
.amr-a11y-section-body {
    padding: 12px 14px; transition: max-height .3s ease, padding .3s ease;
    max-height: 1000px; overflow: hidden;
}
.amr-a11y-section.collapsed .amr-a11y-section-body {
    max-height: 0; padding-top: 0; padding-bottom: 0;
}

/* Sliders */
.amr-a11y-tool { margin-bottom: 14px; }
.amr-a11y-tool-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.amr-a11y-tool-name { font-size: 13px; font-weight: 500; color: #3a3a3a; }
.amr-a11y-tool-value { font-size: 12px; color: #929292; font-weight: 600; background: #f6f6f6; padding: 1px 8px; border-radius: 10px; }
.amr-a11y-slider-row { display: flex; align-items: center; gap: 8px; }
.amr-a11y-slider-btn {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid #e5e5e5; background: #fff; color: #3a3a3a;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; transition: all .15s; flex-shrink: 0; padding: 0;
}
.amr-a11y-slider-btn:hover { border-color: var(--amr-widget-color, #000091); color: var(--amr-widget-color, #000091); background: #e3e3fd; }
.amr-a11y-slider-track { flex: 1; height: 6px; background: #e5e5e5; border-radius: 3px; position: relative; overflow: hidden; }
.amr-a11y-slider-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--amr-widget-color, #000091); border-radius: 3px; transition: width .15s; }

/* Toggles */
.amr-a11y-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #f6f6f6; border-radius: 10px;
    margin-bottom: 8px; cursor: pointer; transition: background .15s, border-color .15s;
    border: 2px solid transparent; user-select: none;
}
.amr-a11y-toggle:hover { background: #eee; }
.amr-a11y-toggle.active { background: #e3e3fd; border-color: var(--amr-widget-color, #000091); }
.amr-a11y-toggle-left { display: flex; align-items: center; gap: 10px; }
.amr-a11y-toggle-icon {
    width: 36px; height: 36px; border-radius: 8px; background: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.amr-a11y-toggle.active .amr-a11y-toggle-icon { background: var(--amr-widget-color, #000091); }
.amr-a11y-toggle-text { font-size: 13px; font-weight: 500; color: #3a3a3a; }
.amr-a11y-toggle-switch {
    width: 42px; height: 24px; border-radius: 12px; background: #ccc;
    position: relative; flex-shrink: 0; transition: background .2s;
}
.amr-a11y-toggle.active .amr-a11y-toggle-switch { background: var(--amr-widget-color, #000091); }
.amr-a11y-toggle-switch::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; top: 2px; left: 2px;
    transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.amr-a11y-toggle.active .amr-a11y-toggle-switch::after { transform: translateX(18px); }

/* Option groups */
.amr-a11y-options { display: flex; gap: 6px; flex-wrap: wrap; }
.amr-a11y-option {
    flex: 1; min-width: 68px; padding: 8px 6px;
    border: 2px solid #e5e5e5; border-radius: 8px; background: #fff;
    text-align: center; cursor: pointer; transition: all .15s;
    font-size: 11px; font-weight: 500; color: #3a3a3a;
}
.amr-a11y-option:hover { border-color: #b0b0b0; }
.amr-a11y-option.active { border-color: var(--amr-widget-color, #000091); background: #e3e3fd; color: var(--amr-widget-color, #000091); font-weight: 700; }
.amr-a11y-option-icon { display: block; font-size: 18px; margin-bottom: 2px; }

/* Footer */
.amr-a11y-footer {
    padding: 8px 18px 10px; border-top: 1px solid #e5e5e5;
    text-align: center; flex-shrink: 0; background: #fafafa;
}
.amr-a11y-footer a {
    font-size: 11px; color: #929292; text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.amr-a11y-footer a:hover { color: var(--amr-widget-color, #000091); }
.amr-a11y-footer svg { width: 14px; height: 14px; fill: currentColor; }

/* ===================================================================
   TTS PLAYER
   =================================================================== */
.amr-tts-buttons { display: flex; gap: 8px; margin-bottom: 8px; }
.amr-tts-btn {
    flex: 1; padding: 10px 8px; border: 2px solid #e5e5e5; border-radius: 10px;
    background: #f6f6f6; color: #3a3a3a; cursor: pointer; font-size: 13px;
    font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all .15s;
}
.amr-tts-btn:hover { border-color: var(--amr-widget-color, #000091); background: #e3e3fd; }
.amr-tts-controls { background: #f0f0f0; border-radius: 10px; padding: 10px; }
.amr-tts-transport { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.amr-tts-ctrl {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: var(--amr-widget-color, #000091); color: #fff;
    cursor: pointer; font-size: 16px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; padding: 0; line-height: 1;
}
.amr-tts-ctrl:hover { opacity: .85; }
.amr-tts-progress { flex: 1; height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.amr-tts-progress-fill { height: 100%; background: var(--amr-widget-color, #000091); border-radius: 3px; width: 0; transition: width .3s; }
.amr-tts-speed-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.amr-tts-speed-row label { font-size: 11px; font-weight: 600; color: #929292; margin-right: 4px; }
.amr-tts-speed-btn {
    padding: 3px 8px; border: 1px solid #ddd; border-radius: 4px;
    background: #fff; color: #3a3a3a; font-size: 11px; cursor: pointer;
}
.amr-tts-speed-btn.active { background: var(--amr-widget-color, #000091); color: #fff; border-color: var(--amr-widget-color, #000091); }
.amr-tts-status { font-size: 11px; color: #929292; margin-top: 6px; min-height: 16px; text-align: center; }

/* === TTS Mini-player (replaces full panel during reading) === */
.amr-tts-miniplayer {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 2147483647;
    background: var(--amr-widget-color, #000091);
    color: #fff; padding: 8px 16px;
    display: none; align-items: center; gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.2);
    animation: amr-slide-up .2s ease;
}
.amr-tts-miniplayer.active { display: flex; }
.amr-tts-mini-label { font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.amr-tts-mini-progress { flex: 1; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; overflow: hidden; cursor: pointer; }
.amr-tts-mini-progress-fill { height: 100%; background: #fff; border-radius: 2px; width: 0; transition: width .3s; }
.amr-tts-mini-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.2); color: #fff;
    cursor: pointer; font-size: 14px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; padding: 0; line-height: 1;
}
.amr-tts-mini-btn:hover { background: rgba(255,255,255,.35); }
.amr-tts-mini-speed { font-size: 11px; background: rgba(255,255,255,.15); padding: 2px 6px; border-radius: 4px; cursor: pointer; border: none; color: #fff; }

/* TTS highlight on page */
.amr-tts-highlight {
    background: rgba(255, 204, 0, .2) !important;
    outline: 2px solid #ffcc00 !important;
    outline-offset: 2px !important;
    border-radius: 3px;
    transition: background .3s, outline .3s;
}

/* ===================================================================
   FALC BANNER TRIGGER
   =================================================================== */
.amr-falc-trigger {
    position: fixed; z-index: 2147483644;
    border: none; background: none;
    padding: 0; margin: 0;
    cursor: pointer;
    transition: transform .2s, opacity .2s;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    max-width: 220px;
}
.amr-falc-trigger:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.amr-falc-trigger.active {
    box-shadow: 0 0 0 3px rgba(79,70,229,.5), 0 4px 16px rgba(0,0,0,.25);
}
.amr-falc-trigger-img {
    display: block;
    width: 100%; height: auto;
    border-radius: 10px;
    pointer-events: none;
}

/* FALC full-screen reader overlay */
.amr-falc-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2147483646;
    background: #fafafa;
    display: none; flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    opacity: 0; transition: opacity .3s ease;
}
.amr-falc-overlay.active { display: flex; opacity: 1; }

.amr-falc-overlay-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: #2f7da8; color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
    flex-shrink: 0;
}
.amr-falc-overlay-title { font-size: 17px; font-weight: 700; }
.amr-falc-overlay-close {
    background: rgba(255,255,255,.2); border: none; color: #fff;
    padding: 8px 18px; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 600; transition: background .15s;
}
.amr-falc-overlay-close:hover { background: rgba(255,255,255,.35); }

.amr-falc-overlay-body {
    flex: 1; overflow-y: auto; padding: 40px 24px 60px;
    -webkit-overflow-scrolling: touch;
}
.amr-falc-overlay-content {
    max-width: 720px; margin: 0 auto;
    font-size: 18px; line-height: 1.9;
    color: #1a1a1a; letter-spacing: .01em; word-spacing: .08em;
}
.amr-falc-overlay-content h1 {
    font-size: 32px; line-height: 1.3; color: #1e3a5f;
    margin-bottom: 16px; font-weight: 800;
    border-bottom: 3px solid #2f7da8; padding-bottom: 12px;
}
.amr-falc-overlay-content h2 { font-size: 24px; color: #2f7da8; margin: 32px 0 12px; font-weight: 700; }
.amr-falc-overlay-content h3 { font-size: 20px; color: #3a7ca5; margin: 24px 0 10px; font-weight: 600; }
.amr-falc-overlay-content p { margin-bottom: 1.2em; }
.amr-falc-overlay-content img {
    max-width: 100%; height: auto; border-radius: 10px;
    margin: 20px 0; box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.amr-falc-overlay-content ul, .amr-falc-overlay-content ol {
    margin: 12px 0 20px 24px; line-height: 2;
}
.amr-falc-overlay-content a { color: #2f7da8; text-decoration: underline; }

.amr-falc-overlay-banner {
    margin: -40px -40px 30px; text-align: center;
}
.amr-falc-overlay-banner img {
    display: block; width: 100%; max-width: 480px; height: auto;
    margin: 0 auto; border-radius: 12px;
}
@media (max-width: 600px) {
    .amr-falc-overlay-banner { margin: -20px -16px 20px; }
    .amr-falc-overlay-banner img { border-radius: 0; }
}
.amr-falc-badge {
    background: #e8f4f8; border-left: 4px solid #2f7da8;
    padding: 14px 18px; border-radius: 0 8px 8px 0;
    margin: 0 0 30px; font-size: 15px; color: #1e3a5f;
    font-weight: 600;
}

.amr-falc-footer-note {
    margin-top: 50px; padding-top: 20px;
    border-top: 1px solid #ddd; font-size: 14px; color: #888;
}

/* No content state */
.amr-falc-no-content {
    text-align: center; padding: 80px 20px;
}
.amr-falc-no-content-icon { font-size: 64px; margin-bottom: 20px; }
.amr-falc-no-content h2 { font-size: 24px; color: #555; margin-bottom: 12px; }
.amr-falc-no-content p { font-size: 16px; color: #888; max-width: 500px; margin: 0 auto 12px; line-height: 1.6; }
.amr-falc-back-btn {
    margin-top: 24px; padding: 12px 28px;
    background: #2f7da8; color: #fff; border: none;
    border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background .15s;
}
.amr-falc-back-btn:hover { background: #256a8f; }

/* ===================================================================
   FALC MODE BAR (hidden, kept for compat)
   =================================================================== */
.amr-falc-bar { display: none !important; }

/* ===================================================================
   ACCESSIBILITY EFFECTS — applied on #amr-content-wrap
   (NOT on body, so position:fixed on panel is preserved)
   =================================================================== */

/* Reading guide */
.amr-reading-guide {
    position: fixed; left: 0; right: 0; height: 40px;
    z-index: 2147483640; pointer-events: none;
    border-top: 2px solid var(--amr-widget-color, #000091);
    border-bottom: 2px solid var(--amr-widget-color, #000091);
    background: rgba(0,0,145,.04); transition: top .05s linear; display: none;
}
.amr-reading-guide.active { display: block; }

/* Reading mask */
.amr-reading-mask-top, .amr-reading-mask-bottom {
    position: fixed; left: 0; right: 0;
    z-index: 2147483639;
    background: rgba(0,0,0,.65);
    pointer-events: none; transition: all .05s linear; display: none;
}
.amr-reading-mask-top.active, .amr-reading-mask-bottom.active { display: block; }
.amr-reading-mask-top.active { top: 0; }
.amr-reading-mask-bottom.active { bottom: 0; }

/* Big cursor */
body.amr-big-cursor, body.amr-big-cursor #amr-content-wrap * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l28 20H20l12 16-4 2-12-16-8 12z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* Readable font */
body.amr-readable-font #amr-content-wrap * { font-family: Arial, Helvetica, 'Segoe UI', sans-serif !important; }

/* Dyslexia font */
body.amr-dyslexia-font #amr-content-wrap * { font-family: 'OpenDyslexic', Arial, Helvetica, sans-serif !important; letter-spacing: .05em; word-spacing: .15em; }

/* Pause animations */
body.amr-pause-animations #amr-content-wrap * { animation-duration: 0s !important; transition-duration: 0s !important; }

/* Link highlight */
body.amr-link-highlight #amr-content-wrap a { outline: 3px solid #ffcc00 !important; outline-offset: 2px; text-decoration: underline !important; background: rgba(255,204,0,.1) !important; }

/* Focus highlight */
body.amr-focus-highlight #amr-content-wrap *:focus { outline: 3px solid #ff6600 !important; outline-offset: 3px; box-shadow: 0 0 0 5px rgba(255,102,0,.2) !important; }

/* Highlight headings */
body.amr-highlight-headings #amr-content-wrap h1,
body.amr-highlight-headings #amr-content-wrap h2,
body.amr-highlight-headings #amr-content-wrap h3,
body.amr-highlight-headings #amr-content-wrap h4,
body.amr-highlight-headings #amr-content-wrap h5,
body.amr-highlight-headings #amr-content-wrap h6 {
    outline: 2px dashed var(--amr-widget-color, #000091) !important;
    outline-offset: 4px; background: rgba(0,0,145,.04) !important;
}

/* Hide images */
body.amr-hide-images #amr-content-wrap img,
body.amr-hide-images #amr-content-wrap svg,
body.amr-hide-images #amr-content-wrap video { opacity: .05 !important; }

/* Text align */
body.amr-text-left #amr-content-wrap * { text-align: left !important; }

/* Word spacing */
body.amr-word-spacing-1 #amr-content-wrap * { word-spacing: .1em !important; }
body.amr-word-spacing-2 #amr-content-wrap * { word-spacing: .2em !important; }
body.amr-word-spacing-3 #amr-content-wrap * { word-spacing: .35em !important; }
body.amr-word-spacing-4 #amr-content-wrap * { word-spacing: .5em !important; }
body.amr-word-spacing-5 #amr-content-wrap * { word-spacing: .7em !important; }

/* (tooltips tool removed in v1.5) */

/* ===================================================================
   CONTRAST / SATURATION — applied on #amr-content-wrap
   Panel stays unaffected!
   =================================================================== */
#amr-content-wrap.amr-filter-contrast-high     { filter: contrast(1.5); }
#amr-content-wrap.amr-filter-contrast-inverted  { filter: invert(1) hue-rotate(180deg); }
#amr-content-wrap.amr-filter-saturation-low     { filter: saturate(.3); }
#amr-content-wrap.amr-filter-saturation-grayscale { filter: grayscale(1); }
#amr-content-wrap.amr-filter-saturation-high    { filter: saturate(2); }

/* Combined */
#amr-content-wrap.amr-filter-contrast-high.amr-filter-saturation-grayscale { filter: contrast(1.5) grayscale(1); }
#amr-content-wrap.amr-filter-contrast-high.amr-filter-saturation-low { filter: contrast(1.5) saturate(.3); }
#amr-content-wrap.amr-filter-contrast-high.amr-filter-saturation-high { filter: contrast(1.5) saturate(2); }
#amr-content-wrap.amr-filter-contrast-inverted.amr-filter-saturation-grayscale { filter: invert(1) hue-rotate(180deg) grayscale(1); }
#amr-content-wrap.amr-filter-contrast-inverted.amr-filter-saturation-low { filter: invert(1) hue-rotate(180deg) saturate(.3); }

/* Re-invert images in inverted mode */
#amr-content-wrap.amr-filter-contrast-inverted img,
#amr-content-wrap.amr-filter-contrast-inverted video,
#amr-content-wrap.amr-filter-contrast-inverted svg { filter: invert(1) hue-rotate(180deg); }

/* Dark mode — color overrides, no filter needed */
body.amr-contrast-dark { background-color: #1a1a2e !important; }
body.amr-contrast-dark #amr-content-wrap { background-color: #1a1a2e; color: #e0e0e0; }
body.amr-contrast-dark #amr-content-wrap * { color: #e0e0e0 !important; border-color: #444 !important; }
/* Give dark bg to block-level and interactive containers */
body.amr-contrast-dark #amr-content-wrap header,
body.amr-contrast-dark #amr-content-wrap footer,
body.amr-contrast-dark #amr-content-wrap nav,
body.amr-contrast-dark #amr-content-wrap main,
body.amr-contrast-dark #amr-content-wrap aside,
body.amr-contrast-dark #amr-content-wrap section,
body.amr-contrast-dark #amr-content-wrap article,
body.amr-contrast-dark #amr-content-wrap div,
body.amr-contrast-dark #amr-content-wrap form,
body.amr-contrast-dark #amr-content-wrap table,
body.amr-contrast-dark #amr-content-wrap th,
body.amr-contrast-dark #amr-content-wrap td,
body.amr-contrast-dark #amr-content-wrap tr,
body.amr-contrast-dark #amr-content-wrap thead,
body.amr-contrast-dark #amr-content-wrap tbody { background-color: #1a1a2e !important; }
/* Menus, dropdowns, popups — slightly lighter so they stand out */
body.amr-contrast-dark #amr-content-wrap ul.sub-menu,
body.amr-contrast-dark #amr-content-wrap ul.children,
body.amr-contrast-dark #amr-content-wrap .sub-menu,
body.amr-contrast-dark #amr-content-wrap .dropdown-menu,
body.amr-contrast-dark #amr-content-wrap .menu-item-has-children > ul,
body.amr-contrast-dark #amr-content-wrap [class*="submenu"],
body.amr-contrast-dark #amr-content-wrap [class*="dropdown"],
body.amr-contrast-dark #amr-content-wrap [class*="popup"],
body.amr-contrast-dark #amr-content-wrap [class*="modal"],
body.amr-contrast-dark #amr-content-wrap [class*="tooltip"],
body.amr-contrast-dark #amr-content-wrap [class*="overlay"],
body.amr-contrast-dark #amr-content-wrap [role="menu"],
body.amr-contrast-dark #amr-content-wrap [role="listbox"],
body.amr-contrast-dark #amr-content-wrap [role="dialog"],
body.amr-contrast-dark #amr-content-wrap select,
body.amr-contrast-dark #amr-content-wrap option { background-color: #252545 !important; }
/* Input fields get a visible dark bg */
body.amr-contrast-dark #amr-content-wrap input,
body.amr-contrast-dark #amr-content-wrap textarea,
body.amr-contrast-dark #amr-content-wrap select { background-color: #2a2a4a !important; color: #e0e0e0 !important; border-color: #555 !important; }
/* Buttons */
body.amr-contrast-dark #amr-content-wrap button,
body.amr-contrast-dark #amr-content-wrap .btn,
body.amr-contrast-dark #amr-content-wrap [type="submit"],
body.amr-contrast-dark #amr-content-wrap [type="button"] { background-color: #333366 !important; color: #e0e0e0 !important; }
/* Links */
body.amr-contrast-dark #amr-content-wrap a { color: #8bb9ff !important; }
/* Images slightly dimmed */
body.amr-contrast-dark #amr-content-wrap img { opacity: .85; }
/* Dark + saturation */
body.amr-contrast-dark #amr-content-wrap.amr-filter-saturation-grayscale { filter: grayscale(1); }

/* Structure overlay */
.amr-structure-overlay {
    position: fixed !important; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2147483645; background: rgba(0,0,0,.88);
    overflow-y: auto; padding: 30px; display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.amr-structure-overlay.active { display: block; }
.amr-structure-overlay h3 { color: #fff; font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.amr-structure-close { background: none; border: 1px solid #fff; color: #fff; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.amr-structure-item { padding: 6px 12px; margin-bottom: 4px; border-radius: 6px; cursor: pointer; transition: background .15s; color: #ddd; font-size: 13px; }
.amr-structure-item:hover { background: rgba(255,255,255,.1); }
.amr-structure-item[data-level="1"] { padding-left: 12px; font-size: 18px; color: #ffcc00; font-weight: 700; }
.amr-structure-item[data-level="2"] { padding-left: 28px; font-size: 16px; color: #6ecbff; font-weight: 600; }
.amr-structure-item[data-level="3"] { padding-left: 44px; font-size: 14px; color: #a8e6cf; }
.amr-structure-item[data-level="4"] { padding-left: 60px; color: #ccc; }
.amr-structure-item[data-level="5"] { padding-left: 76px; font-size: 12px; color: #aaa; }
.amr-structure-item[data-level="6"] { padding-left: 92px; font-size: 12px; color: #888; }
.amr-structure-tag { display: inline-block; background: rgba(255,255,255,.15); color: inherit; padding: 1px 6px; border-radius: 3px; font-size: 10px; margin-right: 6px; font-weight: 700; font-family: monospace; }
.amr-structure-section { margin-bottom: 24px; }
.amr-structure-section-title { color: #929292; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #444; }

/* Responsive */
@media (max-width: 420px) { .amr-a11y-panel { width: calc(100vw - 24px); left: 12px !important; right: 12px !important; } }
@media print { .amr-a11y-trigger, .amr-a11y-panel, .amr-reading-guide, .amr-reading-mask-top, .amr-reading-mask-bottom, .amr-structure-overlay, .amr-tts-miniplayer, .amr-falc-bar, .amr-falc-overlay, .amr-falc-trigger { display: none !important; } }
