/* Read aloud, Explain this and Tap for meaning (v2/readaloud.js; docs/platform/ACCESSIBILITY-POWER-UPS.md parts b, f
   and g). The marks are CSS Custom Highlights drawn over the page: the page's own text and elements never change. */

/* The marks. */
::highlight(ra-sent) { background-color: #fff3b0; color: inherit; }
::highlight(ra-word) { background-color: #ffd24d; color: #0b1f3a; text-decoration: underline 2px; text-underline-offset: 3px; }
::highlight(ra-mine) { background-color: #fff176; color: #0b1f3a; }
::highlight(ra-term) { text-decoration: underline dotted 2px; text-underline-offset: 4px; text-decoration-color: #2f6fb3; }
html.pu-dark ::highlight(ra-sent) { background-color: #4a4300; color: #fff; }
html.pu-dark ::highlight(ra-word) { background-color: #ffd24d; color: #111; }
html.pu-dark ::highlight(ra-mine) { background-color: #ffe866; color: #111; }
html.pu-dark ::highlight(ra-term) { text-decoration-color: #9cc8ff; }
html.pu-high ::highlight(ra-sent) { background-color: #ffe680; color: #000; }
html.pu-high ::highlight(ra-word) { background-color: #000; color: #fff; }
/* A browser without Custom Highlights: the part being read gets a soft outline (a class, not its words). */
.ra-now { outline: 3px solid #ffd24d; outline-offset: 3px; border-radius: 4px; }

/* The top-bar button: the Power-ups button's look (v2/powerups.css .pu-open). */
.ra-top { position: relative; display: flex; align-items: center; }
.ra-open.on, .ra-open[aria-pressed="true"] { background: var(--sky-soft); border-color: var(--navy); }
.ra-float { position: fixed; top: 12px; right: 16px; z-index: 70; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ra-float svg, .ra-open svg { width: 18px; height: 18px; }
.ra-float[aria-pressed="true"] { background: var(--sky-soft); border-color: var(--navy); }
.ra-float:focus-visible, .ra-bar button:focus-visible, .ra-selbar button:focus-visible, .ra-explain button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* The reading bar: bottom left, out of the coach's corner. */
.ra-bar { position: fixed; left: 16px; bottom: 16px; z-index: 65; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 12px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(11,31,58,.16); }
.ra-bar[hidden] { display: none; }
.ra-bar .btn { min-height: 40px; }
.ra-bar .ra-x { margin-left: auto; min-width: 40px; }
.ra-bar p { margin: 0; flex: 1 1 100%; color: var(--muted); }
.ra-bar .ra-note { color: var(--ink); font-weight: 600; }
.ra-bar .ra-state:empty, .ra-bar .ra-note[hidden] { display: none; }
@media (max-width: 640px) { .ra-bar { left: 8px; right: 8px; bottom: 8px; max-width: none; } .ra-bar .ra-hint { display: none; } }

/* The small bar beside selected words. */
.ra-selbar { position: fixed; z-index: 75; display: flex; gap: 6px; padding: 6px; background: #0b1f3a; border-radius: 10px; box-shadow: 0 6px 18px rgba(11,31,58,.25); }
.ra-selbar[hidden] { display: none; }
.ra-selbar .btn { min-height: 40px; }
.ra-selbar .btn.ghost { background: #fff; color: #0b1f3a; border-color: #fff; }

/* The Explain this card. */
.ra-explain { position: fixed; z-index: 80; width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 520px); display: flex; flex-direction: column; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(11,31,58,.22); padding: 12px 14px; }
.ra-explain.ra-sheet { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; }
.ra-explain-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ra-explain-head h2 { font-size: 1.05rem; margin: 0; }
.ra-explain-head h2:focus { outline: none; }
.ra-explain-head h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ra-explain-x { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.1rem; min-width: 44px; min-height: 44px; border-radius: 8px; cursor: pointer; }
.ra-explain-sel { margin: 2px 0 6px; color: var(--muted); }
.ra-explain-body { overflow-y: auto; }
.ra-explain-body p { margin: 0 0 8px; }
.ra-explain-state { margin: 0; color: var(--muted); }
.ra-explain-state:empty { display: none; }
.ra-explain-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

html.pu-dark .ra-bar, html.pu-dark .ra-explain, html.pu-dark .ra-float { background: #14202e; color: #f2f5f8; border-color: #3a4a5c; }
html.pu-dark .ra-explain-x { color: #f2f5f8; }
html.pu-high .ra-bar, html.pu-high .ra-explain { border: 2px solid #000; }

/* The Power-ups panel section (OptiPowerUps.addSection). */
.ra-sel-acts .btn { min-height: 40px; }
.ra-sel-acts .btn[hidden] { display: none; }
@media print { .ra-ui { display: none !important; } }
