/* Same vertical bar as FreeCell join. Native bars stay hidden, including when the
   OS is set to always show scrollbars. The custom bar is added by script only
   when the page content is taller than the view. */
html,
body,
#join-queue-screen,
#waiting-section,
#games-stage {
  scrollbar-width: none;
}
/* Join, lobby, and All Games stage stay locked until the script confirms overflow. */
#join-queue-screen,
#waiting-section.minimal-lobby,
#games-stage {
  overflow-y: hidden !important;
}
#join-queue-screen.themed-scroll-needed,
#waiting-section.minimal-lobby.themed-scroll-needed,
#games-stage.themed-scroll-needed {
  overflow-y: auto !important;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
#join-queue-screen::-webkit-scrollbar,
#waiting-section::-webkit-scrollbar,
#games-stage::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.themed-scroll-host {
  scrollbar-width: none;
}
.themed-scroll-host::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.themed-scroll {
  position: fixed;
  z-index: 220;
  width: 28px;
  display: flex;
  justify-content: center;
  align-items: stretch;
  box-sizing: border-box;
  padding: 10px 8px;
  background: #05070D;
  right: 0;
}
.themed-scroll[hidden] {
  display: none;
}
.themed-scroll-track {
  position: relative;
  width: 10px;
  border-radius: 999px;
  background: #0B1220;
  border: 1px solid #1E3A5F;
  box-sizing: border-box;
}
.themed-scroll-thumb {
  position: absolute;
  left: 1px;
  right: 1px;
  border-radius: 999px;
  background: #1A8CFF;
  box-shadow: 0 0 6px rgba(61, 155, 255, 0.55);
  cursor: grab;
  touch-action: none;
}
.themed-scroll-thumb.is-drag {
  cursor: grabbing;
}
.themed-scroll-thumb[hidden] {
  display: none;
}
/* Phone layouts never show a scrollbar. Touch can still move a page that is taller than the screen. */
@media (max-width: 767px) {
  html, body, * {
    scrollbar-width: none !important;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  *::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }
  .themed-scroll {
    display: none !important;
  }
  #join-queue-screen,
  #waiting-section.minimal-lobby,
  #games-stage {
    overflow-y: auto !important;
  }
}

/* iPad landscape. These pages scroll with no themed bar. */
@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1260px) and (min-height: 700px) and (max-height: 900px),
       (orientation: landscape) and (min-width: 1300px) and (max-width: 1400px) and (min-height: 960px) and (max-height: 1100px) {
  .themed-scroll,
  #themed-scroll { display: none !important; }
  #games-stage,
  #join-queue-screen,
  #waiting-section,
  #waiting-section.minimal-lobby {
    overflow-y: auto !important;
    scrollbar-width: none !important;
  }
}

/* iPad portrait. An open join story can scroll. The themed bar stays hidden. */
@media (orientation: portrait) and (min-width: 744px) and (max-width: 1100px) {
  .themed-scroll,
  #themed-scroll { display: none !important; }
  html:has(.ir-join-tale.is-open) #join-queue-screen,
  html:has(.ir-join-tale.is-open) #waiting-section,
  html:has(.ir-join-tale.is-open) #waiting-section.minimal-lobby {
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
  }
}
