/* OBEINSON FREQUENCY X — the entry gates get the window to themselves.
 *
 * A scrollbar appeared down the right of the PIN screen on desktop with nothing
 * to scroll. Measured: the overlay itself does not overflow at any normal
 * laptop size (card 647px in an 808px box at 1366x768, 716 in 935 at 1512x982),
 * and the page behind it cannot scroll either — `body` is already
 * `overflow:hidden`. What is left is `html`, which carries `overflow-y:auto`,
 * and the app scales the whole document with CSS `zoom`. Zoom leaves sub-pixel
 * remainders — content 900.3px tall in a 900px viewport — and `auto` answers
 * that with a real scrollbar that scrolls essentially nothing. Integer
 * measurements round it away, which is why it reads as 0 overflow and still
 * shows a bar.
 *
 * While a full-screen gate is up there is nothing behind it to reach, so the
 * document simply does not need a scrollbar. Each gate is `position:fixed;
 * inset:0` with its own `overflow:auto`, so nothing can be stranded by this.
 *
 * :has() is doing the work. A browser without it drops the rule and the bar
 * stays — the old behaviour, not a broken one.
 */
html.obnHasGate {
  overflow: hidden !important;
}

/* ---------------------------------------------------------------------------
 * The keypad on a short window.
 *
 * At 1280x520, where the app's auto-fit drops to `zoom: 0.7`, the bottom row of
 * the PIN keypad sat 21px below the window. I first reported it as unreachable.
 * That was wrong, and the way it was wrong is worth keeping: I measured
 * `#pinOv`, which legitimately has nothing to scroll (scrollHeight 743 ==
 * clientHeight 743), and concluded nothing could. The scroller is the CARD
 * inside it — scrollHeight 680 against clientHeight 478 — and scrolling it does
 * bring the last key fully into view and into a hit test. So the keys were
 * always reachable; they were below the fold with nothing to say so.
 *
 * The cause is the zoom trap this repo keeps meeting. The site-config rule
 *
 *     .acCard,…,.pinCard,… { max-height: min(92vh, 100% - 16px) !important }
 *
 * is right everywhere the page is not zoomed. Under `zoom: 0.7`, `92vh`
 * resolves to 478px of LAYOUT space, which paints as 335px of the 520px the
 * person can actually see — the card is capped at about two thirds of the
 * window and its content spills into a scroll nobody asked for. The
 * `100% - 16px` half of that `min()` is already zoom-correct, because the
 * overlay is `position: fixed; inset: 0` and so is measured in the same layout
 * pixels as its child. So the fix is to let that half win on the entry gates:
 * 703px of content box rather than 478px, which the keypad's 680px fits inside.
 *
 * Scoped to the three gates on purpose. The vendor rule covers a dozen dialogs
 * and `92vh` is doing real work in the ones that are genuinely long; these
 * three are the screens with no way past them, so they are the ones that have
 * to fit.
 */
#pinOv .pinCard,
.eulaOv .eulaCard,
#regOv .regCard {
  max-height: calc(100% - 16px) !important;
}

/* And room to breathe rather than an exact fit: on a short window the spinning
   mark is the one thing on this screen that is decoration, so it gives up its
   space first and the keypad keeps its full-size targets. */
@media (max-height: 640px) {
  #pinOv #pinLogo {
    width: 76px !important;
    height: 76px !important;
  }
  #pinOv .pinPad {
    gap: 9px !important;
  }
}

/* A phone held sideways is 393px tall, and at that height the mark cannot be
   made small enough to buy the room — so it goes, and the keys keep their size.
   Nothing is lost: the mark is on the catalog, the player and every other
   screen, and this is the one screen where what matters is hitting the digits.
   Measured at 852x393: without this the last row needs a scroll; with it the
   whole keypad is in view and hit-tests. */
@media (max-height: 460px) {
  #pinOv #pinLogo {
    display: none !important;
  }
  #pinOv .pinPad {
    gap: 7px !important;
  }
  /* Hiding the mark recovered most of it but left the bottom row 61 layout px
     short — measured, not estimated. The keys give up the rest: 52px of layout
     is 47px on the glass at this zoom, still a comfortable target, and four
     rows of it is 64px back. "Forgot your PIN? Reset the app" stays whatever
     happens: it is the only way back from a PIN nobody remembers. */
  #pinOv .pinPad button {
    height: 52px !important;
    min-height: 0 !important;
    padding: 0 !important;
  }
}
