html, body, #game {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game {
  display: flex;
  align-items: center;
  justify-content: center;
}

#game canvas {
  max-width: 100vw !important;
  max-height: 100dvh !important;
  margin: 0 !important;
}

#mobile-launcher {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(150deg, #050b18f5, #102853f5);
  text-align: center;
}

#mobile-launcher.hidden { display: none; }

.mobile-launcher-card {
  width: min(430px, 100%);
  padding: 28px 22px;
  border: 3px solid #38e8ff;
  border-radius: 20px;
  background: #09142df5;
  box-shadow: 0 20px 80px #000c, 0 0 38px #38e8ff38;
}

.mobile-launcher-card .phone-icon {
  color: #58f2bd;
  font: 700 48px/1 monospace;
  transform: rotate(-35deg);
}

.mobile-launcher-card strong {
  display: block;
  margin: 12px 0 8px;
  font: 700 24px/1.2 monospace;
}

.mobile-launcher-card span {
  display: block;
  max-width: 330px;
  margin: 0 auto 22px;
  color: #d8eaff;
  font: 16px/1.4 system-ui;
}

#fullscreen-button {
  width: 100%;
  min-height: 56px;
  border: 2px solid #ff79ac;
  border-radius: 12px;
  color: #fff;
  background: #e63f83;
  box-shadow: 0 8px 28px #0007;
  font: 700 19px monospace;
}

#fullscreen-toggle {
  position: fixed;
  z-index: 11000;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 46px;
  height: 46px;
  border: 2px solid #ffffff99;
  border-radius: 11px;
  color: #fff;
  background: #09142dcc;
  font: 700 25px/1 monospace;
  cursor: pointer;
}

@media (pointer: fine) {
  #fullscreen-toggle { display: none; }
}

@media (orientation: portrait) and (pointer: coarse) {
  .mobile-launcher-card .phone-icon {
    animation: turn-phone 1.8s ease-in-out infinite alternate;
  }
}

@keyframes turn-phone {
  from { transform: rotate(0deg); }
  to { transform: rotate(-90deg); }
}

/* Mobile game controls: prevent browser gestures stealing touches. */
#game, #game canvas {
  touch-action: none !important;
  -webkit-tap-highlight-color: transparent;
}

@media (pointer: coarse) and (orientation: landscape) {
  #game canvas { width: 100vw !important; height: 100dvh !important; }
  #fullscreen-toggle { opacity: .72; width: 40px; height: 40px; }
}

/* v4: use every available pixel on mobile. Phaser EXPAND keeps the game ratio
   while enlarging the game viewport, so wider phones reveal more of the school. */
@media (pointer: coarse) and (orientation: landscape) {
  html, body, #game { width: 100vw !important; height: 100dvh !important; }
  #game { position: fixed !important; inset: 0 !important; display: block !important; }
  #game canvas { position: absolute !important; inset: 0 !important; width: 100vw !important; height: 100dvh !important; max-width: none !important; max-height: none !important; }
}
