/* V1.113 — the codex hub and its child libraries retain one nested modal session. */
html body.game-codex-modal-open:not(.maintenance-mode) {
  overflow: hidden;
  overscroll-behavior: none;
}

html body.game-codex-modal-open:not(.maintenance-mode) > [data-game-codex-modal-inert="true"] {
  pointer-events: none !important;
  user-select: none !important;
  touch-action: none !important;
}

html body.game-codex-modal-open:not(.maintenance-mode) :is(
  #gameCodexDialog,
  #characterCodexDialog,
  #professionCodexDialog,
  #opportunityLibraryDialog,
  #artifactLibraryDialog
):not([hidden]) {
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

html body.game-codex-modal-open:not(.maintenance-mode) #gameCodexDialog .game-codex-box {
  max-height: min(92dvh, 820px);
  overflow: auto;
  overscroll-behavior: contain;
}

html body.game-codex-modal-open:not(.maintenance-mode) #closeGameCodex:focus-visible {
  outline: 2px solid #f0cd72 !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(234, 193, 85, 0.18), 0 0 20px rgba(235, 190, 71, 0.2) !important;
}

@media (max-width: 720px) {
  html body.game-codex-modal-open:not(.maintenance-mode) #gameCodexDialog .game-codex-box {
    max-height: calc(100dvh - max(14px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.game-codex-modal-open:not(.maintenance-mode) #gameCodexDialog,
  html body.game-codex-modal-open:not(.maintenance-mode) #gameCodexDialog .game-codex-box {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  html body.game-codex-modal-open:not(.maintenance-mode) #gameCodexDialog .game-codex-box,
  html body.game-codex-modal-open:not(.maintenance-mode) #closeGameCodex:focus-visible {
    border: 2px solid CanvasText !important;
    outline: 2px solid Highlight !important;
    box-shadow: none !important;
  }
}
