/* Latest screenshot reference: the cream My Ninjas paper occupies about
   58% of the game width. Its title/close paint extends beyond the paper.
   The logical popup stage already fits the live game once; there is no
   second blanket 80% shrink and no independent 80% text shrink here. */
#game-container[data-approved-ui] #app .game-popup-layer > .approved-window-shell,
#game-container[data-approved-ui] #modal-root > .modal-backdrop > :is(.approved-modal-shell,.battle-modal) {
  scale:1;
  transform-origin:center;
}
#game-container[data-approved-ui] :is(
  .ninja-owned-v2,.equipment-ui,.classic-progression,.ninja-catalogue,.catalogue-design,
  .modal:has(>.classic-progression,>.ninja-catalogue,>.catalogue-design)
) {--panel-text-scale:var(--popup-text-scale);}

/* Ink is 15% smaller; the paper, button art and icon geometry retain the
   accepted source sizes. Variable-based families already apply this once.
   The existing popup pager measures other live text before fitting pages. */
#game-container[data-approved-ui] {--popup-text-scale:.85;}
#game-container[data-approved-ui]:not([data-popup-text-measure]) [data-popup-font-original] {
  font-size:calc(var(--popup-font-original) * var(--popup-text-scale))!important;
}

/* Regular cream papers keep a common safe area. Their existing paginator
   measures this live layout; cards/forms and the close hit target stay native. */
#game-container[data-approved-ui] #app .game-popup-layer > .approved-window-shell:not(.my-bag-shell):not(:has(.ninja-owned-v2,[data-classic-v2-shell],[data-my-bag-panel])),
#game-container[data-approved-ui] #modal-root > .modal-backdrop > .approved-modal-shell:not(:has(.equipment-ui,[data-classic-v2-shell],.ninja-owned-v2)) {
  width:61cqw!important;
  height:82cqh!important;
  max-width:none;
  max-height:86cqh!important;
  aspect-ratio:auto;
}
/* Short ordinary dialogs may use less paper than a roster, while staying
   within the same frame. Dense wide dialogs retain the common main profile. */
#game-container[data-approved-ui] #modal-root > .modal-backdrop > .approved-modal-shell:not(.wide):not(:has(.equipment-ui,[data-classic-v2-shell],.ninja-owned-v2)) {
  width:49cqw!important;
  height:68cqh!important;
  max-height:82cqh!important;
}

/* Native illustrated books have their own silhouette/aspect. Fit the source
   rather than stretching its rim or cropping it into the common rectangle. */
#game-container[data-approved-ui] #modal-root > .modal-backdrop > .approved-modal-shell:has([data-classic-v2-shell]) {
  width:min(61cqw,calc(82cqh * var(--v2-aspect)))!important;
  height:auto!important;
  max-height:none!important;
  aspect-ratio:var(--v2-aspect)!important;
}

/* The 677×497 Ninja source contains transparent header/edge margins.
   810 logical pixels give its painted paper approximately the reference
   width, keeping the original artwork aspect and its cqw typography. The
   same source geometry is used at 480p/720p/1080p and both supported ratios. */
#game-container[data-approved-ui] #app .game-popup-layer > .approved-window-shell:has(.ninja-owned-v2),
#game-container[data-approved-ui] #modal-root > .modal-backdrop > .approved-modal-shell:has(.ninja-owned-v2) {
  width:810px!important;
  height:auto!important;
  max-height:none!important;
  aspect-ratio:677 / 497!important;
  scale:1;
}

/* Equipment retains its approved 600.25×413.325 source and the dedicated
   835.555556px logical stage. A single composition factor brings its visible
   paper to the same approximately58% footprint; fixed fonts, slot art,
   vertical item details and action end caps share that exact factor. */
#game-container[data-approved-ui] #modal-root > .modal-backdrop > .approved-modal-shell:has(.equipment-ui) {
  scale:.82;
  transform-origin:center;
}
