
/* Bingo Live 1.4.3 — app-like touch gestures.
   Keep normal panning and pinch zoom, but stop browsers treating a rapid double tap as a zoom command. */
html,
body,
button,
a,
input,
select,
textarea,
[role="button"],
.number-cell,
.game-button,
.admin-tab,
.admin-button,
.host-call-next,
.host-mini-action{
  touch-action:manipulation;
}

/* Bingo Live 1.4.2 — shared mobile/tablet soft-keyboard behaviour.
   The keyboard overlays a stable app composition instead of triggering a full-page redesign. */
:root{
  --keyboard-base-height:100dvh;
  --keyboard-visible-height:100dvh;
  --keyboard-offset-top:0px;
  --keyboard-shift:0px;
  --keyboard-height:0px;
}

body.keyboard-focus{
  --keyboard-transition:transform .18s ease;
}

/* Controller: freeze the pre-keyboard composition and only lift it as much as needed. */
body.controller-page.keyboard-focus{
  height:var(--keyboard-base-height)!important;
  min-height:var(--keyboard-base-height)!important;
  max-height:var(--keyboard-base-height)!important;
  overflow:hidden!important;
}
body.controller-page.keyboard-focus .controller-app{
  height:var(--keyboard-base-height)!important;
  min-height:var(--keyboard-base-height)!important;
  max-height:var(--keyboard-base-height)!important;
  transform:translateY(calc(var(--keyboard-offset-top) + var(--keyboard-shift)))!important;
  transform-origin:top center;
  transition:var(--keyboard-transition);
}

/* Player: retain the already-measured pre-keyboard app height. */
body.player-page.keyboard-focus .player-app{
  height:var(--keyboard-base-height)!important;
  max-height:var(--keyboard-base-height)!important;
  transform:translateX(-50%) translateY(calc(var(--keyboard-offset-top) + var(--keyboard-shift)))!important;
  transition:var(--keyboard-transition);
}

/* Stage display join screen gets the same treatment on tablets/phones. */
body.display-page.keyboard-focus{
  min-height:var(--keyboard-base-height)!important;
  overflow:hidden!important;
}
body.display-page.keyboard-focus .display-app{
  min-height:var(--keyboard-base-height)!important;
  transform:translateY(calc(var(--keyboard-offset-top) + var(--keyboard-shift)));
  transform-origin:top center;
  transition:var(--keyboard-transition);
}

/* Admin keeps its natural document height. Login is lifted only when necessary.
   Modal editors use their own scrolling region above the keyboard instead. */
body.admin-page.keyboard-focus{
  min-height:var(--keyboard-base-height)!important;
}
body.admin-page.keyboard-focus .admin-shell{
  min-height:var(--keyboard-base-height)!important;
  transform:translateY(var(--keyboard-shift));
  transform-origin:top center;
  transition:var(--keyboard-transition);
}
body.admin-page.keyboard-focus .admin-login-wrap{
  min-height:calc(var(--keyboard-base-height) - 74px)!important;
}
body.admin-page.keyboard-open .admin-modal{
  height:var(--keyboard-visible-height)!important;
  min-height:0!important;
  top:var(--keyboard-offset-top)!important;
  bottom:auto!important;
  overflow:hidden!important;
}
body.admin-page.keyboard-open .admin-dialog{
  max-height:calc(var(--keyboard-visible-height) - 10px)!important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  scroll-padding-top:74px;
  scroll-padding-bottom:96px;
}

/* Prevent browser zooming inputs on iOS and keep touch targets comfortably app-like. */
body.player-page input,
body.controller-page input,
body.controller-page select,
body.admin-page input,
body.admin-page select,
body.admin-page textarea,
body.display-page input{
  font-size:max(16px,1em);
}

@media(prefers-reduced-motion:reduce){
  body.keyboard-focus .controller-app,
  body.keyboard-focus .player-app,
  body.keyboard-focus .display-app,
  body.keyboard-focus .admin-shell{transition:none!important}
}
