/* Shared logical design frame for both ordinary windows and modal popups.
   Container queries and CSS ink/artwork dimensions use the same coordinates;
   the entire frame then fits the live game, including 16:10 and intermediate sizes. */
#game-container {--game-ui-scale:.8}
#game-container #app .game-popup-layer,
#game-container #modal-root>.modal-backdrop {
  position:absolute;inset:auto;left:50%;top:50%;
  width:var(--popup-design-width,1280px);height:var(--popup-design-height,720px);
  min-width:0;min-height:0;max-width:none;max-height:none;
  transform:translate(-50%,-50%) scale(var(--popup-design-scale,1));
  transform-origin:center;container-type:size;container-name:game;
  display:flex;align-items:center;justify-content:center;
  padding:14px;overflow:hidden;
}
/* Close remains a separate orange artwork component for every ordinary popup. */
#game-container[data-approved-ui] :is(.game-window,.modal):not(.battle-modal) :is(.window-close,.modal-heading>.icon-button) {
  background:transparent url('/assets/equipment/reference-v2/ui/close-orange.svg') center/contain no-repeat;
  border:0;border-image:none;box-shadow:none;color:transparent;padding:0;
}
#game-container[data-approved-ui] :is(.game-window,.modal):not(.battle-modal) :is(.window-close,.modal-heading>.icon-button)>.icon {visibility:hidden}

/* Equipment's approved gallery uses its own source coordinate size. The
   complete sheet scales once: detail paper, fonts, icons and controls retain
   the same proportions as the 870 × 715 reference screenshot. */
#game-container #modal-root>.modal-backdrop:has(.equipment-ui) {
  width:var(--equipment-popup-design-width,835.555556px);
  height:var(--equipment-popup-design-height,470px);
  padding:0;
  transform:translate(-50%,-50%) scale(var(--equipment-popup-design-scale,1));
}
#game-container[data-approved-ui] #modal-root .approved-modal-shell:has(.equipment-ui[data-equipment-view]) {
  width:var(--equipment-reference-width,600.25px)!important;
  height:var(--equipment-reference-height,413.325px)!important;
  max-height:var(--equipment-reference-height,413.325px)!important;
}

/* Keep the full-frame shade and logical layout; compact each visible sheet
   once, including its text, artwork, close button and nested item details. */
#game-container #app .game-popup-layer>.approved-window-shell,
#game-container #modal-root>.modal-backdrop>:is(.approved-modal-shell,.battle-modal) {
  scale:var(--game-ui-scale);
  transform-origin:center;
}
/* The two dense inventory sheets tighten a further 5% after their live copy
   becomes smaller, keeping the approved columns and fixed page capacity. */
#game-container #app .game-popup-layer>.approved-window-shell:has(.ninja-owned-v2),
#game-container #modal-root>.modal-backdrop>.approved-modal-shell:has(.equipment-ui) {
  scale:calc(var(--game-ui-scale) * .95);
}
