/* R17: make the document scrollbar visible and keep long pages easy to follow. */
html {
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #344d68 #ece8df;
  scroll-padding-top: calc(var(--r17-header-height, 64px) + 12px);
  scroll-padding-bottom: 96px;
}
body { overflow-y: visible; }
html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 11px; height: 11px; }
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: #ece8df;
  border-inline-start: 1px solid #d2ccbf;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid #ece8df;
  border-radius: 999px;
  background: #344d68;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover { background: #0a1b30; }
.bar {
  position: sticky;
  inset-block-start: 0;
  z-index: 60;
}
main#lesson {
  padding-block-end: 96px;
  scroll-margin-block-start: calc(var(--r17-header-height, 64px) + 12px);
}
.player-shell .journey {
  position: sticky;
  inset-block-start: calc(var(--r17-header-height, 64px) + 12px);
  align-self: start;
  max-block-size: calc(100vh - var(--r17-header-height, 64px) - 24px);
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #d9e1e9 #172b42;
}
.player-shell .journey::-webkit-scrollbar { width: 11px; }
.player-shell .journey::-webkit-scrollbar-track {
  background: #172b42;
  border-inline-start: 1px solid #506175;
}
.player-shell .journey::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid #172b42;
  border-radius: 999px;
  background: #d9e1e9;
}
.player-shell .journey::-webkit-scrollbar-thumb:hover { background: #fff; }
.player-shell .slide-nav {
  position: sticky !important;
  inset-block-end: 0;
  z-index: 55;
  padding-block: 1rem;
  background: #fff;
  box-shadow: 0 -8px 20px #0a1b3012;
}
.r17-scroll-cue-shadow,
.r17-scroll-cue { position: fixed; pointer-events: none; }
.r17-scroll-cue-shadow {
  z-index: 45;
  inset-inline: 0;
  inset-block-end: 0;
  height: 112px;
  background: linear-gradient(0deg, #0a1b3024, #0a1b3000);
}
.r17-scroll-cue-shadow[hidden] { display: none !important; }
.r17-scroll-cue {
  z-index: 80;
  display: grid;
  place-items: center;
  inline-size: 52px;
  block-size: 52px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #0a1b30;
  box-shadow: 0 3px 14px #07182e55;
  color: #fff;
  font: 800 1.7rem/1 system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease, background-color 160ms ease;
}
.r17-scroll-cue:hover { background: #087f77; transform: translateY(-2px); }
.r17-scroll-cue:focus-visible { outline: 3px solid #d8a525; outline-offset: 3px; }
.r17-scroll-cue[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .player-shell .journey {
    position: static;
    inset-block-start: auto;
    max-block-size: none;
    overflow: visible !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .r17-scroll-cue { transition: none; }
}

/* Keep complex overview/history/map screens in the natural document flow. */
#lesson .intro-screen:not(.opening-film),
#lesson .cinematic-library.slide-panel {
  block-size: auto !important;
  min-block-size: 0;
  max-block-size: none !important;
  overflow: visible !important;
}
#lesson .intro-screen-body,
#lesson .cinematic-library > .cinematic-groups {
  block-size: auto !important;
  min-block-size: 0;
  max-block-size: none !important;
  overflow: visible !important;
}
#lesson .intro-screen-controls { flex-shrink: 1; }
