/* Reading only: one scroll region per side; the document remains scrollable. */
html body .ae-reading-grid {
  --ae-reading-size: calc(100vh - 200px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: start !important;
  min-height: 0 !important;
  min-width: 0;
  height: auto !important;
  overflow: visible !important;
  gap: 18px;
}
html body .ae-reading-grid > .ae-reading-pane,
html body .ae-reading-grid > .pane > .ae-reading-pane {
  box-sizing: border-box;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: var(--ae-reading-size) !important;
  max-height: var(--ae-reading-size) !important;
  overflow: auto !important;
  overscroll-behavior: auto !important;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--nx-accent, #674195) var(--nx-soft, #f0eaf8);
  position: static !important;
  scroll-margin-top: var(--ae-reading-top, 110px);
  scroll-behavior: auto;
  overflow-wrap: break-word;
}
html body .ae-reading-pane:focus-visible {
  outline: 3px solid var(--nx-accent, #674195) !important;
  outline-offset: 3px;
}
/* Nested legacy regions become content of the single named outer panel. */
html body .ae-reading-pane > .scroll,
html body .ae-reading-pane .passage,
html body .ae-reading-pane .reading-document-body {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
  scrollbar-gutter: auto;
}
html body .ae-reading-screen {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}
html body .ae-reading-grid .pane-head {
  position: sticky;
  top: 0;
  z-index: 3;
  flex-shrink: 0;
}
html body .ae-reading-grid > .pane:not(.ae-reading-pane) {
  min-height: 0;
  min-width: 0;
}
/* Preserve KUEPE's vocabulary card as its own optional third column. */
html body .ae-reading-grid.ae-reading-kuepe {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.04fr) minmax(230px, .5fr) !important;
  flex: none !important;
}
html body .ae-reading-kuepe > .vocab-pane {
  min-height: 0;
  max-height: var(--ae-reading-size);
}
@media (max-width: 980px) {
  html body .ae-reading-grid.ae-reading-kuepe {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }
}
@media (max-width: 900px) {
  html body .ae-reading-grid,
  html body .ae-reading-grid.ae-reading-kuepe {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html body .ae-reading-grid > .ae-reading-pane,
  html body .ae-reading-grid > .pane > .ae-reading-pane {
    height: var(--ae-reading-mobile-size, 55vh) !important;
    max-height: var(--ae-reading-mobile-size, 55vh) !important;
  }
}
@supports (height: 100dvh) {
  html body .ae-reading-grid { --ae-reading-size: calc(100dvh - 200px); }
}
@media print {
  html body .ae-reading-grid,
  html body .ae-reading-grid > .ae-reading-pane,
  html body .ae-reading-grid > .pane > .ae-reading-pane {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
