/* Header global fixo e area segura para todas as janelas do jogo. */
:root {
  --nrmt-fixed-header-height: var(--bi-top, 58px);
  --nrmt-layer-header: 2147483000;
  --nrmt-layer-submenu: 2147483600;
}

body.nrmt-baiak-layout [class*="_topHud_"] {
  position: fixed !important;
  inset: 0 0 auto 0 !important;
  z-index: var(--nrmt-layer-header) !important;
  width: 100vw !important;
  height: var(--nrmt-fixed-header-height) !important;
  overflow: visible !important;
  isolation: isolate;
  transform: translateZ(0);
}

body.nrmt-baiak-layout [class*="_topHudNavigation_"],
body.nrmt-baiak-layout .nrmt-top-menu-grouped,
body.nrmt-baiak-layout .nrmt-menu-group.is-open {
  overflow: visible !important;
}

/* O dropdown e movido para o body quando abre. Esta camada precisa superar
   lojas, inventario, admin e qualquer outra janela. */
body.nrmt-baiak-layout .nrmt-menu-group__dropdown,
body.nrmt-baiak-layout .nrmt-menu-group__dropdown.is-portal {
  z-index: var(--nrmt-layer-submenu) !important;
}

/* Overlays de interface usam somente a viewport abaixo do header. Efeitos de
   combate e telas de carregamento ficam fora desta lista de proposito. */
body.nrmt-baiak-layout :is(
  .xp-overlay,
  .inventory-overlay,
  .equipment-overlay,
  .missions-overlay,
  .leaderboard-overlay,
  .shop-overlay,
  .crafting-overlay,
  .admin-overlay,
  .nrmt-admin-v2,
  .nrmt-shop-overlay,
  .nrmt-inventory-overlay,
  .nrmt-hunts-overlay,
  .nrmt-craft-overlay,
  .nrmt-ninja-collection,
  .nrmt-mailbox,
  .nrmt-pvp,
  .nrmt-pvp-overlay,
  .nrmt-bi-helper,
  .nrmt-bi-rotation,
  .nrmt-team-select-overlay,
  .nrmt-game-overlay,
  .nrmt-breed-overlay,
  .nrmt-clinic-overlay,
  .nrmt-depot-overlay,
  .nrmt-edo-overlay,
  .nrmt-market-overlay,
  .nrmt-referral-overlay,
  .nrmt-discord-overlay,
  .nrmt-hunt-analyzer-overlay,
  .nrmt-buffs-panel,
  .nrmt-copy-center-modal,
  .nrmt-modal-overlay,
  .nrmt-modal-backdrop,
  .nrmt-ninja-overlay,
  .nrmt-ranking-overlay,
  .nrmt-smith-overlay,
  .nrmt-summon-modal,
  .nrmt-wiki-overlay,
  .nrmt-wiki,
  .nto-content-overlay,
  .nrmt-profile-overlay,
  .covil-prep-overlay,
  #nrmt-covil,
  #nrmt-bijuu-seal-choice,
  #nrmt-player-interaction,
  #nrmt-player-trade,
  #nrmt-premium-shop,
  #nrmt-ramen-store,
  #nrmt-shop-v2,
  #nrmt-skins,
  #nrmt-tutorial,
  #nrmt-vip-store-v2
) {
  top: var(--nrmt-fixed-header-height) !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: auto !important;
  max-height: calc(100vh - var(--nrmt-fixed-header-height)) !important;
  box-sizing: border-box !important;
  padding-top: clamp(8px, 1.5vh, 18px) !important;
}

/* Janelas grandes respeitam a nova altura util mesmo quando uma folha antiga
   ainda usa 90vh/95vh, que antes fazia a moldura entrar sob o header. */
body.nrmt-baiak-layout :is(
  .xp-overlay,
  .inventory-overlay,
  .equipment-overlay,
  .missions-overlay,
  .leaderboard-overlay,
  .shop-overlay,
  .crafting-overlay,
  .admin-overlay,
  .nrmt-shop-overlay,
  .nrmt-inventory-overlay,
  .nrmt-hunts-overlay,
  .nrmt-craft-overlay,
  .nrmt-bi-helper,
  .nrmt-bi-rotation,
  .nrmt-team-select-overlay,
  .nrmt-breed-overlay,
  .nrmt-clinic-overlay,
  .nrmt-depot-overlay,
  .nrmt-edo-overlay,
  .nrmt-market-overlay,
  .nrmt-referral-overlay,
  .nrmt-discord-overlay,
  .nrmt-hunt-analyzer-overlay,
  .nrmt-buffs-panel,
  .nrmt-copy-center-modal,
  .nrmt-modal-overlay,
  .nrmt-ranking-overlay,
  .nrmt-smith-overlay,
  .nrmt-wiki-overlay,
  .nrmt-wiki,
  .nto-content-overlay,
  .nrmt-profile-overlay,
  #nrmt-covil,
  #nrmt-bijuu-seal-choice,
  #nrmt-player-interaction,
  #nrmt-player-trade,
  #nrmt-premium-shop,
  #nrmt-ramen-store,
  #nrmt-shop-v2,
  #nrmt-skins,
  #nrmt-vip-store-v2
) > :is(
  [class*="-window"],
  [class*="__window"],
  [class$="-modal"],
  [class$="-shell"]
) {
  max-height: calc(100% - 16px) !important;
  box-sizing: border-box !important;
}

body.nrmt-baiak-layout #nrmt-bijuu-seal-choice > .nrmt-bijuu-seal-card,
body.nrmt-baiak-layout .nrmt-buffs-panel > section {
  max-height: calc(100% - 16px) !important;
  box-sizing: border-box !important;
}

/* O HUD flutuante criado na V141 tambem nasce sempre abaixo do header. */
body.nrmt-baiak-layout #nrmt-bi-right.nrmt-bi-floating-layer {
  top: var(--nrmt-fixed-header-height) !important;
  height: calc(100vh - var(--nrmt-fixed-header-height)) !important;
}

@media (max-width: 680px) {
  body.nrmt-baiak-layout :is(
    .xp-overlay,
    .inventory-overlay,
    .equipment-overlay,
    .missions-overlay,
    .leaderboard-overlay,
    .shop-overlay,
    .crafting-overlay,
    .admin-overlay,
    .nrmt-shop-overlay,
    .nrmt-inventory-overlay,
    .nrmt-hunts-overlay,
    .nrmt-craft-overlay,
    .nrmt-bi-helper,
    .nrmt-bi-rotation,
    .nrmt-team-select-overlay,
    .nrmt-breed-overlay,
    .nrmt-market-overlay,
    .nrmt-referral-overlay,
    .nrmt-discord-overlay,
    .nrmt-hunt-analyzer-overlay,
    .nrmt-buffs-panel,
    .nrmt-copy-center-modal,
    .nrmt-modal-overlay,
    .nrmt-ranking-overlay,
    .nrmt-wiki-overlay,
    .nrmt-wiki,
    .nto-content-overlay,
    #nrmt-covil,
    #nrmt-bijuu-seal-choice,
    #nrmt-premium-shop,
    #nrmt-ramen-store,
    #nrmt-shop-v2,
    #nrmt-skins,
    #nrmt-vip-store-v2
  ) {
    padding: 5px !important;
    padding-top: 5px !important;
  }

  body.nrmt-baiak-layout .nrmt-menu-group__dropdown.is-portal {
    top: var(--nrmt-fixed-header-height) !important;
    max-height: calc(100vh - var(--nrmt-fixed-header-height) - 6px) !important;
    overflow-y: auto !important;
  }
}
