/**
 * One scrollbar per dock panel — no nested scrolls, no empty scroll deserts.
 * Loaded after other dock CSS.
 */

/* Overlays never scroll — the panel owns the only scrollbar */
#lms-hw-root .lms-hw__modal,
#lms-hw-root .lms-tools,
#lms-hw-root .lms-rewards,
#lms-hw-root .lms-dock-preview,
#lms-hw-root .myedu-coach-pop {
    overflow: hidden !important;
}

/* —— Rewards: only .lms-rewards__panel-scroll scrolls —— */
#lms-hw-root .lms-rewards__panel {
    overflow: hidden !important;
}

#lms-hw-root .lms-rewards__panel-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
}

#lms-hw-root [data-lms-rewards-home],
#lms-hw-root .lms-rewards__shop,
#lms-hw-root .lms-rewards__shop-pane,
#lms-hw-root .lms-rewards__shop-pane--customize,
#lms-hw-root .lms-rewards__shop-create,
#lms-hw-root .lms-avatar-studio__layout,
#lms-hw-root .lms-avatar-studio__rail,
#lms-hw-root .lms-avatar-studio__options {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    min-height: 0;
}

#lms-hw-root .lms-rewards__body {
    overflow: visible !important;
    height: auto !important;
    min-height: 0;
    align-items: start !important;
    flex: 0 0 auto !important;
}

#lms-hw-root .lms-rewards__aside,
#lms-hw-root .lms-rewards__main {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
}

#lms-hw-root .lms-rewards__topics,
#lms-hw-root .lms-rewards__cert-list,
#lms-hw-root .lms-rewards__badges .myedu__badge-rack,
#lms-hw-root .lms-rewards__shop-grid,
#lms-hw-root .lms-avatar-studio__ai-grid {
    overflow: visible !important;
    max-height: none !important;
    flex: 0 0 auto !important;
}

#lms-hw-root .lms-rewards__certs,
#lms-hw-root .lms-rewards__badges {
    flex: 0 0 auto !important;
    margin-top: 0.85rem;
}

#lms-hw-root .lms-avatar-studio__group--remix {
    margin-top: 0.35rem !important;
}

#lms-hw-root .lms-avatar-studio__actions {
    margin-top: 0.35rem !important;
}

/* —— My Edu: only .myedu__grid scrolls —— */
#lms-hw-root .lms-tools__panel--myedu,
#lms-hw-root .lms-tools__panel--myedu > .lms-tools__livewire,
#lms-hw-root .myedu {
    overflow: hidden !important;
}

#lms-hw-root .myedu__grid {
    overflow: auto !important;
    overscroll-behavior: contain;
}

#lms-hw-root .myedu__quotes-stack {
    overflow: visible !important;
    max-height: none !important;
}

#lms-hw-root .myedu-coach-pop__panel {
    overflow: hidden !important;
}

#lms-hw-root .myedu-coach-pop__body {
    flex: 1;
    min-height: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
}

#lms-hw-root .myedu-coach-pop__quotes,
#lms-hw-root .myedu-coach-pop__main {
    overflow: visible !important;
    max-height: none !important;
}

/* —— Tools / Notes / Calendar / Book / Support: one body scroll —— */
#lms-hw-root .lms-tools__panel {
    overflow: hidden !important;
}

#lms-hw-root .lms-tools__panel > .lms-tools__body,
#lms-hw-root .lms-tools__panel .lms-tools__layout > .lms-tools__body,
#lms-hw-root .lms-tools__panel:not(.lms-tools__panel--myedu) > .lms-tools__livewire {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
}

#lms-hw-root .lms-tools__panel > .lms-tools__layout {
    overflow: hidden !important;
}

#lms-hw-root .lms-tools__media-grid {
    overflow: visible !important;
    max-height: none !important;
}

#lms-hw-root .tickets__grid,
#lms-hw-root .tickets__thread,
#lms-hw-root .tickets aside,
#lms-hw-root .tickets main {
    overflow: visible !important;
    max-height: none !important;
}

/* Notes / Calendar / Book / Support: fill shell; scroll inside panes only */
#lms-hw-root .lms-tools__panel--notes > .lms-tools__livewire--fill,
#lms-hw-root .lms-tools__panel--calendar > .lms-tools__livewire--fill,
#lms-hw-root .lms-tools__panel--book > .lms-tools__livewire--fill,
#lms-hw-root .lms-tools__panel--support > .lms-tools__livewire--fill {
    overflow: hidden !important;
}

#lms-hw-root .notes,
#lms-hw-root .cal-board,
#lms-hw-root .book,
#lms-hw-root .tickets {
    overflow: hidden !important;
}

#lms-hw-root .notes__side,
#lms-hw-root .notes__ai-scroll,
#lms-hw-root .notes__body,
#lms-hw-root .cal-board__workspace,
#lms-hw-root .cal-board__day-list,
#lms-hw-root .cal-board__list,
#lms-hw-root .cal-board__ai-scroll,
#lms-hw-root .book__service-grid,
#lms-hw-root .book__main,
#lms-hw-root .book__mine-list,
#lms-hw-root .book__ai-scroll,
#lms-hw-root .tickets__list,
#lms-hw-root .tickets__thread,
#lms-hw-root .tickets__ai-scroll {
    overflow: auto !important;
}

/* —— Canvas / Homework: dialog shell fixed; only stage / gallery scroll —— */
#lms-hw-root .lms-hw__dialog {
    overflow: hidden !important;
}

#lms-hw-root .lms-hw__stage-wrap {
    overflow: hidden !important;
}

#lms-hw-root .lms-hw__gallery-grid {
    overflow: auto !important;
    overscroll-behavior: contain;
}

#lms-hw-root .lms-hw__pop-panel {
    max-height: min(50vh, 22rem);
    overflow: auto !important;
}

/* —— Preview: only stage scrolls —— */
#lms-hw-root .lms-dock-preview__panel {
    overflow: hidden !important;
}

#lms-hw-root .lms-dock-preview__stage {
    overflow: auto !important;
    overscroll-behavior: contain;
}

/* —— Mobile: still one scroll; stack customize as one flow —— */
@media (max-width: 900px) {
    #lms-hw-root .lms-hw__modal,
    #lms-hw-root .lms-tools,
    #lms-hw-root .lms-rewards,
    #lms-hw-root .lms-dock-preview,
    #lms-hw-root .myedu-coach-pop {
        overflow: hidden !important;
    }

    #lms-hw-root .lms-avatar-studio__layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    #lms-hw-root .lms-avatar-studio__rail,
    #lms-hw-root .lms-avatar-studio__options {
        overflow: visible !important;
        max-height: none !important;
    }

    #lms-hw-root .myedu__grid {
        overflow: auto !important;
    }

    #lms-hw-root .myedu__quotes-stack {
        overflow: visible !important;
        max-height: none !important;
    }
}
