/* Correção final da janela dos jogos: esta regra deve permanecer por último. */
:root {
  --ct-game-stage-height: min(62vh, 500px);
}

#arcade-shell {
  min-width: 0 !important;
}

#game-wrap,
.arcade-shell.mode-iframe #game-wrap {
  position: relative !important;
  width: 100% !important;
  height: var(--ct-game-stage-height) !important;
  min-height: 360px !important;
  max-height: none !important;
  overflow: hidden !important;
  isolation: isolate;
  background: #050b18 !important;
  border-radius: 18px !important;
}

#connect-dynamic-game-frame.game-frame,
#connect-dynamic-game-frame.game-frame:not(.hidden) {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: inherit !important;
  background: #050b18 !important;
  pointer-events: auto !important;
  touch-action: none !important;
}

#connect-dynamic-game-frame.game-frame.hidden {
  display: none !important;
}

/* Os jogos Unity deste projeto foram exportados em 960 × 600 (proporção 8:5).
   A janela acompanha essa proporção e elimina rolagem/zoom artificial. */
.arcade-shell.mode-iframe #game-wrap {
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 8 / 5;
}

#game-wrap.connect-fullscreen,
#game-wrap:fullscreen,
#game-wrap:-webkit-full-screen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483500 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  border-radius: 0 !important;
}

#game-wrap.connect-fullscreen #connect-dynamic-game-frame.game-frame,
#game-wrap:fullscreen #connect-dynamic-game-frame.game-frame,
#game-wrap:-webkit-full-screen #connect-dynamic-game-frame.game-frame {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border-radius: 0 !important;
}

body.connect-game-fullscreen,
body.is-game-fullscreen {
  overflow: hidden !important;
}

.exit-fullscreen-game-btn {
  display: none;
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2147483647;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  background: rgba(4,12,28,.84);
  color: #fff;
  font: 700 14px/1 system-ui, sans-serif;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  cursor: pointer;
  touch-action: manipulation;
}

.exit-fullscreen-game-btn span { font-size: 23px; line-height: 0; }

#game-wrap.connect-fullscreen .exit-fullscreen-game-btn,
#game-wrap:fullscreen .exit-fullscreen-game-btn,
#game-wrap:-webkit-full-screen .exit-fullscreen-game-btn {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  #game-wrap.connect-fullscreen .exit-fullscreen-game-btn,
  #game-wrap:fullscreen .exit-fullscreen-game-btn,
  #game-wrap:-webkit-full-screen .exit-fullscreen-game-btn {
    display: inline-flex;
  }
}

.connect-game-switch-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: grid;
  place-items: center;
  padding: 20px;
}

.connect-game-switch-modal.hidden { display: none; }

.connect-game-switch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 5, 16, .72);
  backdrop-filter: blur(7px);
}

.connect-game-switch-dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid rgba(99, 209, 255, .35);
  border-radius: 22px;
  background: linear-gradient(145deg, #102142, #061124);
  color: #f4f8ff;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .5);
  text-align: center;
}

.connect-game-switch-icon { display: block; margin-bottom: 8px; font-size: 34px; }
.connect-game-switch-dialog h3 { margin: 0; font-size: 22px; }
.connect-game-switch-dialog p { margin: 12px 0 24px; color: #b9c9e8; line-height: 1.5; }
.connect-game-switch-close { position: absolute; top: 10px; right: 14px; border: 0; background: transparent; color: #c8d5ed; font-size: 27px; cursor: pointer; }
.connect-game-switch-actions { display: flex; justify-content: center; gap: 10px; }
.connect-game-switch-actions button { min-height: 42px; padding: 0 16px; border-radius: 11px; font: inherit; font-weight: 700; cursor: pointer; }
.connect-game-switch-cancel { border: 1px solid rgba(193, 213, 243, .35); background: transparent; color: #e7efff; }
.connect-game-switch-confirm { border: 0; background: linear-gradient(135deg, #18ddb1, #429cff); color: #03101e; }

@media (max-width: 480px) {
  .connect-game-switch-dialog { padding: 26px 18px 20px; }
  .connect-game-switch-actions { flex-direction: column-reverse; }
  .connect-game-switch-actions button { width: 100%; }
}

@media (max-width: 767px) {
  :root {
    --ct-game-stage-height: min(62vh, 430px);
  }

  #game-wrap,
  .arcade-shell.mode-iframe #game-wrap {
    min-height: 0 !important;
  }
}
