#readingToolsDock {
    position: fixed;
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1085;
    max-width: calc(100vw - 20px);
    font-size: 14px;
    line-height: 1.4;
    color: #e2e8f0;
}
#readingToolsToggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    min-height: 44px;
    padding: 10px 15px;
    border: 1px solid rgba(148,163,184,.3);
    border-radius: 999px;
    color: #e2e8f0;
    background: #172537;
    box-shadow: 0 4px 16px #0003;
    font: inherit;
    cursor: pointer;
}
#readingToolsToggle[aria-expanded="true"] { border-color: #34d399; color: #a7f3d0; }
#readingToolsPanel {
    width: min(320px, calc(100vw - 20px));
    max-height: calc(100dvh - 180px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid #334155;
    border-radius: 18px;
    background: #101c2d;
    box-shadow: 0 16px 48px #0006;
}
#readingToolsDock [hidden] { display: none !important; }
#readingToolsPanel .reading-tools-heading { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
#readingToolsClose { border: 0; background: transparent; color: #cbd5e1; font-size: 24px; width: 36px; height: 36px; cursor: pointer; }
#readingToolsPanel .reading-tools-section { border-top: 1px solid #ffffff12; margin-top: 12px; padding-top: 12px; }
#readingToolsPanel h2 { font-size: 12px !important; font-weight: 600; color: #94a3b8; margin: 0 0 8px; }
/* Override the old viewport positions only while controls are inside this panel. */
#readingToolsDock #readingToolsPanel :is(#globalTextSizeToolbar, #notePreviewFontToolbar, #readAloudToolbar, #pomodoro, #sessionTimer, #sessionTimerPanel) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    flex-wrap: wrap !important;
    justify-content: flex-start;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 8px;
    background: transparent !important;
    padding: 0 !important;
    gap: 6px;
    overflow: visible !important;
}
#readingToolsDock #readingToolsPanel #sessionTimerPanel { margin-top: 10px; }
#readingToolsDock #readingToolsPanel :is(#globalTextSizeToolbar, #notePreviewFontToolbar, #readAloudToolbar, #pomodoro, #sessionTimer):not([hidden]) {
    display: flex !important;
}
#readingToolsDock #readingToolsPanel .read-aloud-voice-menu { position: static !important; width: 100%; min-width: 0; margin-top: 8px; }
#readingToolsDock button:focus-visible { outline: 2px solid #6ee7b7; outline-offset: 3px; }
/* Creation remains a direct action when the other utilities are tucked away. */
html body.page-scrolled-hide-widgets:not(.note-preview-open) .floating-new-note-btn,
html body.note-preview-open.note-preview-scrolled-hide-extras .floating-new-note-btn {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
}

/* Keep Create immediately to the left of Tools on one bottom row. */
html body .floating-new-note-btn {
    right: calc(20px + var(--reading-tools-width, 145px)) !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Center the navigation group itself, including after scroll visibility changes. */
html body .feed-explore-floating-shortcuts,
html body.note-preview-open #notePreviewModal #notePreviewModalContent .note-preview-page-shortcuts-floating {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    width: max-content !important;
    max-width: calc(100vw - 20px);
    margin: 0 !important;
    transform: translateX(-50%) !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
}
@media (max-width: 767.98px) {
    html body .feed-explore-floating-shortcuts,
    html body.note-preview-open #notePreviewModal #notePreviewModalContent .note-preview-page-shortcuts-floating {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
