.readerControl {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rightSidebar .readerControl {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.rightSidebar .readerListenButton,
.rightSidebar .readerRestartButton,
.rightSidebar .readerPrimaryButton,
.rightSidebar .readerReplayButton,
.rightSidebar .readerPreviousButton,
.rightSidebar .readerNextButton,
.rightSidebar .readerRateButton {
    width: 100%;
    justify-content: center;
}

.readerListenButton:disabled, .readerRestartButton:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Exactly one pair shows at a time (cf. applyStatus() in reader.js), never both together, to keep
   the control down to 2 buttons at rest instead of stacking every action. Same on/off mechanism
   as .visible on .menuDiv/dropdowns elsewhere. */
.readerListenButton, .readerRestartButton, .readerPrimaryButton, .readerReplayButton,
.readerPreviousButton, .readerNextButton {
    display: none;
}

.readerListenButton.visible, .readerRestartButton.visible, .readerPrimaryButton.visible,
.readerReplayButton.visible, .readerPreviousButton.visible, .readerNextButton.visible {
    display: inline-flex;
}

/* Replaces every button above (cf. createReaderControl() in reader-control.js) once
   hasUsableVoice() confirms the browser has the Web Speech API but no voice to actually use it
   with -- e.g. Brave on Linux, cf. todo.md. */
.readerUnavailableNotice {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.readerAutoAdvanceNotice {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.readerRateWrapper {
    position: relative;
}

.readerRateMenu {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    inset-inline-start: 0;
    min-width: 100px;
    list-style: none;
    margin: 0;
    padding: 0.4rem;
    background-color: var(--bg-deep);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
    border-radius: var(--radius);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    z-index: 30;
}

.readerRateMenu.visible {
    display: block;
}

.readerRateOption {
    display: block;
    width: 100%;
    text-align: start;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.5rem 0.6rem;
    margin: 0.1rem 0;
    border-radius: 6px;
    cursor: pointer;
}

.readerRateOption:hover {
    background-color: var(--bg-hover);
    color: var(--accent);
}

.readerRateOption.current {
    color: var(--accent);
    font-weight: 600;
}

/* shown only below the mobile breakpoint, cf. responsive.css -- .rightSidebar (which carries
   the desktop instance) is hidden there, same as .leftSidebar */
.readerFloatingBar {
    display: none;
}

/* cf. js/reader-debug.js -- only mounted at all behind ?debug=1, so no need to hide it by default.
   Anchored below the navbar rather than at the bottom: .readerFloatingBar (the mobile play/pause
   controls this is meant to debug) lives at inset-block-end: 0 -- overlapping it there would hide
   the very buttons needed to drive the test it's used for. pointer-events: none as a second line of
   defense, so a long log (tall enough to reach the controls anyway) still can't eat their taps;
   the overlay auto-scrolls itself on every new line (cf. logEvent()), so it needs no touch input. */
#readerDebugOverlay {
    position: fixed;
    inset-block-start: var(--navbar-height, 57px);
    inset-inline: 0;
    max-height: 30vh;
    overflow-y: auto;
    pointer-events: none;
    margin: 0;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.85);
    color: #0f0;
    font-size: 0.7rem;
    line-height: 1.3;
    white-space: pre-wrap;
    z-index: 9999;
}

/* Base highlight for the segment read aloud (cf. setHighlightedEntry() in reader.js).
   .readerSegment is an inline wrapper, painting one line-box at a time. `tr.readerActiveParagraph`
   covers a table row: connector words with no DOM word of their own fall back to this tint. */
.readerSegment.readerActiveParagraph, code.readerActiveParagraph {
    background-color: color-mix(in srgb, var(--accent) 15%, transparent);
    border-radius: 0.25rem;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.readerSegment.readerActiveParagraph {
    padding: 4px;
}

/* `tr.readerActiveParagraph` alone would be invisible: a cell's own background-color always
   paints over its row's. Tinting each cell directly instead, mixed into its opaque base
   (Louis, 2026-08-16: the highlight silently stopped showing once rows became the target). */
tr.readerActiveParagraph > td {
    background-color: color-mix(in srgb, var(--accent) 15%, var(--bg-elevated-2));
}

tr.readerActiveParagraph > th {
    background-color: color-mix(in srgb, var(--accent) 15%, var(--bg-elevated));
}

/* Rules above target a table's generic (non-.page) surface; inside chapter content -- the only
   place a table with this class actually renders -- .page td/th already darken to
   rgba(0,0,0,0.4)/(0.55) instead (content.css), so the highlight needs its own base here too,
   or a row lighting up would revert it to the old flat surface. */
.page tr.readerActiveParagraph > td {
    background-color: color-mix(in srgb, var(--accent) 15%, var(--bg-deep));
}

.page tr.readerActiveParagraph > th {
    background-color: color-mix(in srgb, var(--accent) 20%, var(--bg-deep));
}

/* The one active word (cf. setActiveWord() in reader.js), replacing readerActiveParagraph's
   softer highlight with a stronger tint so it reads as "this exact word". */
.readerWord.readerActiveWord {
    background-color: color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: 0.2rem;
}
