/* Global viewport-level textbook reader. Kept outside Reveal's scaled canvas. */
.text-dock-launcher {
    position: fixed;
    right: 24px;
    bottom: 86px;
    z-index: 15000;
    display: none;
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(95, 238, 225, .76);
    border-radius: 14px;
    color: #d9ffff;
    background: rgba(3, 25, 53, .9);
    box-shadow: 0 0 18px rgba(69, 230, 255, .26), inset 0 0 12px rgba(80, 232, 224, .08);
    cursor: pointer;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.text-dock-launcher.is-visible { display: inline-flex; }
.text-dock-launcher:hover { border-color: #abfff7; background: rgba(5, 48, 75, .96); transform: scale(1.05); }
.text-dock-launcher:focus-visible { outline: 2px solid #abfff7; outline-offset: 3px; }
.text-dock-launcher::after {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: 210px;
    padding: 7px 9px;
    border: 1px solid rgba(95, 238, 225, .35);
    border-radius: 5px;
    color: #d9ffff;
    background: rgba(3, 25, 53, .96);
    content: attr(data-tooltip);
    font: 700 11px/1.2 Arial, sans-serif;
    letter-spacing: .06em;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease;
}
.text-dock-launcher:hover::after,
.text-dock-launcher:focus-visible::after { opacity: 1; transform: translateY(0); }
.text-dock-launcher-mark {
    position: relative;
    display: block;
    width: 18px;
    height: 21px;
    border: 1.5px solid #78f1e5;
    border-radius: 2px 5px 5px 2px;
    box-shadow: inset 4px 0 0 rgba(120, 241, 229, .12);
}
.text-dock-launcher-mark::before,
.text-dock-launcher-mark::after {
    position: absolute;
    left: 5px;
    width: 8px;
    height: 1px;
    background: #78f1e5;
    content: "";
}
.text-dock-launcher-mark::before { top: 7px; }
.text-dock-launcher-mark::after { top: 12px; }
body:has(.page-jump-panel.is-open) .text-dock-launcher { right: 156px; }

.text-dock-backdrop { position: fixed; z-index: 20000; inset: 0; display: none; background: rgba(0, 7, 24, .35); }
.text-dock-backdrop.is-open { display: block; }
.text-dock {
    position: fixed;
    z-index: 20001;
    top: 0;
    right: 0;
    display: flex;
    width: min(46vw, 760px);
    height: 100vh;
    flex-direction: column;
    color: #e8fbff;
    background: rgba(6, 24, 47, .96);
    box-shadow: -18px 0 42px rgba(0, 4, 18, .38);
    transform: translateX(100%);
    transition: transform 420ms cubic-bezier(.22, .8, .22, 1);
}
.text-dock.is-open { transform: translateX(0); }

.text-dock-header { display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 24px; border-bottom: 1px solid rgba(95, 238, 225, .3); background: rgba(5, 35, 66, .98); }
.text-dock-heading { min-width: 0; }
.text-dock-label { display: block; color: #6eece0; font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.text-dock-title { display: block; margin-top: 4px; color: #fff; font-size: 19px; font-weight: 750; line-height: 1.2; }
.text-dock-function { display: block; margin-top: 4px; color: #9cc4d2; font-size: 13px; }
.text-dock-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.text-dock-mode { display: inline-flex; overflow: hidden; border: 1px solid rgba(95, 238, 225, .42); border-radius: 6px; }
.text-dock-mode-button,
.text-dock-close { border: 0; color: #a9cad4; background: transparent; font: 700 10px/1 Arial, sans-serif; letter-spacing: .06em; cursor: pointer; }
.text-dock-mode-button { min-height: 30px; padding: 0 8px; }
.text-dock-mode-button + .text-dock-mode-button { border-left: 1px solid rgba(95, 238, 225, .3); }
.text-dock-mode-button.is-active { color: #e8ffff; background: rgba(50, 176, 180, .2); }
.text-dock-close { padding: 9px 10px; border: 1px solid rgba(95, 238, 225, .45); border-radius: 6px; color: #d9ffff; }
.text-dock-mode-button:hover,
.text-dock-close:hover { background: rgba(88, 226, 216, .14); }
.text-dock-mode-button:focus-visible,
.text-dock-close:focus-visible { outline: 2px solid #abfff7; outline-offset: -2px; }

.text-dock-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 24px 26px 40px; scrollbar-color: #2a8492 #0b2645; }
.text-dock-paragraph { margin: 0 0 24px; }
.text-dock-paragraph-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.text-dock-paragraph-badge { padding: 4px 7px; border: 1px solid rgba(95, 238, 225, .58); border-radius: 5px; color: #70f1e5; background: rgba(24, 157, 159, .14); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.text-dock-sentence { margin: 0 0 7px; padding: 7px 10px; border-left: 2px solid transparent; border-radius: 4px; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.text-dock-sentence:hover,
.text-dock-sentence.is-selected { border-left-color: #5eead4; background: rgba(62, 191, 207, .1); }
.text-dock-sentence.is-source-cn { cursor: text; }
.text-dock-sentence.is-source-cn:hover { border-left-color: transparent; background: transparent; }
.text-dock-sentence-en { font-size: 19px; line-height: 1.68; }
.text-dock-sentence-cn { display: none; margin-top: 5px; color: #aeced5; font-size: 16px; line-height: 1.62; }
.text-dock-sentence.is-selected .text-dock-sentence-cn,
.text-dock.is-bilingual .text-dock-sentence-cn { display: block; }

@media (max-width: 900px) {
    .text-dock { width: min(88vw, 620px); }
    .text-dock-launcher { right: 18px; bottom: 78px; width: 48px; height: 48px; }
    body:has(.page-jump-panel.is-open) .text-dock-launcher { right: 140px; }
    .text-dock-header { align-items: flex-start; flex-direction: column; gap: 12px; padding: 16px 18px; }
    .text-dock-controls { width: 100%; justify-content: space-between; }
    .text-dock-body { padding: 20px 18px 30px; }
    .text-dock-sentence-en { font-size: 18px; }
    .text-dock-sentence-cn { font-size: 15px; }
}
