/**
 * 定语从句 · 内容超出视口时显示滚动条（页面本身不整体滚动）
 */
:root {
  --l13rc-scrollbar-w: 10px;
  --l13rc-scrollbar-thumb: rgba(14, 165, 233, 0.45);
  --l13rc-scrollbar-thumb-hover: rgba(14, 165, 233, 0.65);
  --l13rc-scrollbar-track: rgba(148, 163, 184, 0.2);
}

/* 可见滚动条（替代原全局隐藏） */
.l13rc-no-scroll .l13rc-scroll-region,
.l13rc-no-scroll.l13rc-scroll-region,
body.l13rc-no-scroll.has-lesson-pager > .app-container,
body.l13rc-no-scroll.has-lesson-pager > #app-frame,
body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active,
body.l13rc-no-scroll .l13rc-scroll,
body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel,
body.l13rc-no-scroll.g-index-scaled .g-index,
body.l13rc-no-scroll.grammar-handout-page > main.sheet,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body,
body.l13rc-no-scroll .practice-answer-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--l13rc-scrollbar-thumb) var(--l13rc-scrollbar-track);
}

.l13rc-no-scroll .l13rc-scroll-region::-webkit-scrollbar,
.l13rc-no-scroll.l13rc-scroll-region::-webkit-scrollbar,
body.l13rc-no-scroll.has-lesson-pager > .app-container::-webkit-scrollbar,
body.l13rc-no-scroll.has-lesson-pager > #app-frame::-webkit-scrollbar,
body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active::-webkit-scrollbar,
body.l13rc-no-scroll .l13rc-scroll::-webkit-scrollbar,
body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel::-webkit-scrollbar,
body.l13rc-no-scroll.g-index-scaled .g-index::-webkit-scrollbar,
body.l13rc-no-scroll.grammar-handout-page > main.sheet::-webkit-scrollbar,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active::-webkit-scrollbar,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body::-webkit-scrollbar,
body.l13rc-no-scroll .practice-answer-panel::-webkit-scrollbar {
  width: var(--l13rc-scrollbar-w);
  height: var(--l13rc-scrollbar-w);
  display: block;
}

.l13rc-no-scroll .l13rc-scroll-region::-webkit-scrollbar-track,
.l13rc-no-scroll.l13rc-scroll-region::-webkit-scrollbar-track,
body.l13rc-no-scroll.has-lesson-pager > .app-container::-webkit-scrollbar-track,
body.l13rc-no-scroll.has-lesson-pager > #app-frame::-webkit-scrollbar-track,
body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active::-webkit-scrollbar-track,
body.l13rc-no-scroll .l13rc-scroll::-webkit-scrollbar-track,
body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel::-webkit-scrollbar-track,
body.l13rc-no-scroll.g-index-scaled .g-index::-webkit-scrollbar-track,
body.l13rc-no-scroll.grammar-handout-page > main.sheet::-webkit-scrollbar-track,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active::-webkit-scrollbar-track,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body::-webkit-scrollbar-track,
body.l13rc-no-scroll .practice-answer-panel::-webkit-scrollbar-track {
  background: var(--l13rc-scrollbar-track);
  border-radius: 999px;
}

.l13rc-no-scroll .l13rc-scroll-region::-webkit-scrollbar-thumb,
.l13rc-no-scroll.l13rc-scroll-region::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.has-lesson-pager > .app-container::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.has-lesson-pager > #app-frame::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active::-webkit-scrollbar-thumb,
body.l13rc-no-scroll .l13rc-scroll::-webkit-scrollbar-thumb,
body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.g-index-scaled .g-index::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.grammar-handout-page > main.sheet::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active::-webkit-scrollbar-thumb,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body::-webkit-scrollbar-thumb,
body.l13rc-no-scroll .practice-answer-panel::-webkit-scrollbar-thumb {
  background: var(--l13rc-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.l13rc-no-scroll .l13rc-scroll-region::-webkit-scrollbar-thumb:hover,
.l13rc-no-scroll.l13rc-scroll-region::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.has-lesson-pager > .app-container::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.has-lesson-pager > #app-frame::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll .l13rc-scroll::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.g-index-scaled .g-index::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.grammar-handout-page > main.sheet::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body::-webkit-scrollbar-thumb:hover,
body.l13rc-no-scroll .practice-answer-panel::-webkit-scrollbar-thumb:hover {
  background: var(--l13rc-scrollbar-thumb-hover);
}

/* —— 主舞台：课件 / 练习 —— */
@media screen {
  body.l13rc-no-scroll.has-lesson-pager > .app-container,
  body.l13rc-no-scroll.has-lesson-pager > #app-frame {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.l13rc-no-scroll.has-lesson-pager > .app-container.l13rc-scroll-region,
  body.l13rc-no-scroll.has-lesson-pager > #app-frame.l13rc-scroll-region {
    /* class 由 fit-viewport 在需要时添加 */
  }

  body.l13rc-no-scroll.has-lesson-pager > .app-container > .page.active,
  body.l13rc-no-scroll.has-lesson-pager.l13rc-demo-screen > .app-container > .page.active {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  body.l13rc-no-scroll.l13rc-uses-scroll > .app-container,
  body.l13rc-no-scroll.l13rc-uses-scroll > #app-frame,
  body.l13rc-no-scroll > .app-container.l13rc-uses-scroll,
  body.l13rc-no-scroll > #app-frame.l13rc-uses-scroll {
    overflow-y: auto !important;
  }

  body.l13rc-no-scroll.l13rc-practice-one #app-frame.practice-book.is-started {
    overflow-y: auto !important;
  }

  body.l13rc-no-scroll.l13rc-practice-one .practice-page.active {
    overflow-y: auto !important;
    justify-content: flex-start !important;
  }

  body.l13rc-no-scroll.l13rc-practice-one .practice-page.active .practice-body {
    overflow-y: auto !important;
    justify-content: flex-start !important;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* 拓展课 #l13rc-book */
  body.l13rc-no-scroll.has-lesson-pager > #app {
    overflow: hidden !important;
    min-height: 0;
  }

  body.l13rc-no-scroll #l13rc-book.book {
    overflow: hidden !important;
    min-height: 0;
  }

  body.l13rc-no-scroll .l13rc-scroll {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel,
  body.l13rc-no-scroll .l13rc-scroll > .lesson-page.active > .panel.panel-split {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  body.l13rc-no-scroll #l13rc-book .quiz-slot,
  body.l13rc-no-scroll #l13rc-book .corpus-list,
  body.l13rc-no-scroll #l13rc-book .corpus-list--preview,
  body.l13rc-no-scroll #l13rc-book .tier-list {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: min(52vh, 480px);
    -webkit-overflow-scrolling: touch;
  }

  /* 目录 */
  body.l13rc-no-scroll.g-index-scaled .g-index {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* 讲义 */
  body.l13rc-no-scroll.grammar-handout-page > main.sheet {
    scrollbar-width: thin;
    scrollbar-color: var(--l13rc-scrollbar-thumb) var(--l13rc-scrollbar-track);
  }

  body.l13rc-no-scroll.grammar-handout-page > main.sheet::-webkit-scrollbar {
    width: var(--l13rc-scrollbar-w);
    display: block;
  }

  /* 解析面板、答案区 */
  body.l13rc-no-scroll .practice-answer-panel {
    overflow-y: auto !important;
    max-height: min(42vh, 380px);
  }

  body.l13rc-no-scroll .app-container .p5-left,
  body.l13rc-no-scroll .app-container .p5-right {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: min(45vh, 420px);
  }

  body.l13rc-no-scroll .picture-pick-copy.l13rc-fit-no-scale,
  body.l13rc-no-scroll .picture-pick-text {
    overflow-y: auto !important;
    max-height: 100%;
  }

  /* 缩放仍可用时保持裁切；启用滚动回退时不缩放 */
  body.l13rc-no-scroll .l13rc-fit-no-scale {
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}
