/* Screensaver owns the page, independently of the browser fullscreen API. */
#stage.game-ui[data-screensaver="true"] :is(#world, .horn, #u2-backdrop, #language-stats, #u2-stats, #combo-hud, #u2-clear-status, .utterance, #voice-connection, #stress-exhibit, #exit-exhibit, #screensaver-button) {
  visibility: hidden !important;
  pointer-events: none !important;
}
#stage.game-ui[data-screensaver="true"] .vm-welcome__panel {
  pointer-events: none;
  /* Keep script marks/descenders and the incoming copy's 12px travel inside
     the panel after removing the invitation/carousel that supplied this space. */
  padding-bottom: 20px;
}
/* Release the invisible controls' old empty slots so the logo and copy centre. */
#stage.game-ui[data-screensaver="true"] :is(.vm-welcome__invitation, .vm-welcome__actions, .vm-welcome__carousel) { display: none; }
#stage.game-ui #screensaver-wake {
  position: fixed; inset: 0; z-index: 50;
  display: block; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent;
  box-shadow: none; outline: none; cursor: default;
  -webkit-tap-highlight-color: transparent;
}
#stage.game-ui #screensaver-wake[hidden] { display: none; }
/* A keyboard user can find the full-surface exit; pointer presentation stays clean. */
#stage.game-ui #screensaver-wake:focus-visible { outline: 2px solid #91a2db; outline-offset: -4px; }

/* The interaction fullscreen retains one real microphone control, with the
   existing recording state/error handling, not a second microphone instance. */
#stage.game-ui[data-exhibit="true"] .controls { backdrop-filter: none; }
#stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) #mic-button {
  position: fixed; left: 50%; bottom: 18px; right: auto; top: auto;
  translate: -50% 0; margin: 0; width: min(272px, calc(100vw - 180px));
  min-width: 140px; height: 58px; min-height: 44px;
  visibility: visible; pointer-events: auto; transform: none;
}
#stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) #mic-button b { font-size: 14px; }
#stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) #screensaver-button {
  position: fixed; bottom: 12px; right: 12px; height: 44px;
  visibility: visible; pointer-events: auto;
}
/* Edge-only operator controls. Opacity keeps their real hit areas and keyboard
   focus available; no global mouse tracker, timers or animation-frame work. */
#stage.game-ui[data-exhibit="true"] #exit-exhibit {
  position: fixed; top: 12px; left: 12px; right: auto; bottom: auto;
  height: 44px; min-height: 44px; z-index: 30;
}
#stage.game-ui[data-exhibit="true"] #stress-exhibit {
  position: fixed; top: 12px; right: 12px; left: auto; bottom: auto;
  height: 44px; min-height: 44px; z-index: 30;
}
#stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) :is(#exit-exhibit, #stress-exhibit, #screensaver-button, #mic-button) {
  opacity: 0;
  transition: opacity 140ms ease, background-color 120ms ease, border-color 120ms ease;
}
#stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) :is(#exit-exhibit, #stress-exhibit, #screensaver-button, #mic-button):is(:hover, :focus-visible) {
  opacity: 1;
}
/* Statistics share the upper-right edge but never move as a button appears. */
#stage.game-ui[data-exhibit="true"] :is(#u2-stats, .vm-ledger-host) {
  top: 64px; right: 12px;
}

/* The native-name slot wraps independently of the right-aligned number.
   Use the bundled shaping fonts; never split a language into glyph elements. */
#stage.game-ui #u2-stats { width: min(264px, calc(100vw - 24px)); }
#stage.game-ui #u2-language-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#stage.game-ui #u2-language-counts > div {
  display: grid; grid-template-columns: minmax(0, 1fr) max-content;
  gap: 5px; padding: 6px; align-items: center; min-width: 0;
}
#stage.game-ui #u2-language-counts > div > span {
  min-width: 0; white-space: normal; overflow-wrap: anywhere;
  font: 600 13px/1.5 Arial, "PingFang SC", sans-serif;
}
#stage.game-ui #u2-language-counts b { font-variant-numeric: tabular-nums; text-align: right; }
#stage.game-ui #u2-language-counts :lang(th) { font-family: "Noto Sans Thai Local", Thonburi, sans-serif; font-weight: 700; }
#stage.game-ui #u2-language-counts :lang(lo) { font-family: "Noto Sans Lao Local", "Lao Sangam MN", sans-serif; font-weight: 700; }
#stage.game-ui #u2-language-counts :lang(km) { font-family: "Noto Sans Khmer Local", "Khmer Sangam MN", sans-serif; font-weight: 700; }
#stage.game-ui #u2-language-counts :lang(my) { font-family: "Noto Sans Myanmar Local", "Myanmar Sangam MN", sans-serif; font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  #stage.game-ui[data-exhibit="true"] :is(#exit-exhibit, #stress-exhibit, #screensaver-button, #mic-button) { transition: none; }
}
@media (max-width: 520px) {
  #stage.game-ui[data-exhibit="true"]:not([data-screensaver="true"]) #mic-button { left: 12px; translate: 0 0; width: calc(100vw - 108px); }
}
