html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d083b;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* No scrolling, bouncing, zooming, text selection or long-press menus */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* The game fills the entire screen, edge to edge, including the notch area */
#unity-container {
  position: fixed;
  inset: 0;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d083b;
  outline: none;
}

/* Loading screen */
#loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0d083b;
  transition: opacity 0.4s ease;
  z-index: 10;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
#loading-logo { width: 96px; height: 96px; border-radius: 22px; }
#loading-title { font-size: 20px; font-weight: 600; letter-spacing: 0.04em; }
#progress-track {
  width: 200px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
#progress-fill {
  width: 0%;
  height: 100%;
  background: #66e0ff;
  transition: width 0.2s ease;
}

/* iOS ignores the manifest orientation lock, so ask the player to rotate */
#rotate-screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #0d083b;
  font-size: 18px;
  z-index: 30;
}
#rotate-icon {
  width: 40px;
  height: 64px;
  border: 3px solid #66e0ff;
  border-radius: 8px;
  animation: rotate-hint 2s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
@media (orientation: portrait) {
  #rotate-screen { display: flex; }
}

/* "Add to Home Screen" instructions (iOS only, when not installed) */
.install-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 8px;
}
.install-steps {
  margin: 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.5;
}
.install-steps li { margin-bottom: 4px; }
.install-steps b { color: #66e0ff; font-weight: 600; }
.install-note { font-size: 12px; color: rgba(255, 255, 255, 0.6); }
.install-glyph {
  width: 18px;
  height: 18px;
  margin: 0 2px -4px;
  color: #66e0ff;
}

/* On the loading screen, below the progress bar */
#loading-install {
  max-width: 420px;
  margin-top: 6px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(102, 224, 255, 0.25);
  text-align: left;
}
#loading-install[hidden] { display: none; }

/* Popup over the lobby once the game has loaded */
#install-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px calc(16px + env(safe-area-inset-right, 0px)) 16px calc(16px + env(safe-area-inset-left, 0px));
  background: rgba(5, 3, 25, 0.7);
  z-index: 20;
  animation: install-fade 0.3s ease;
}
#install-popup[hidden] { display: none; }
@keyframes install-fade { from { opacity: 0; } to { opacity: 1; } }
.install-card {
  display: flex;
  gap: 16px;
  max-width: 520px;
  max-height: 100%;
  overflow-y: auto;
  padding: 18px 20px;
  border-radius: 18px;
  background: #1a1452;
  border: 1px solid rgba(102, 224, 255, 0.35);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.install-icon { width: 64px; height: 64px; border-radius: 15px; flex-shrink: 0; }
#install-title { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.install-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.install-actions button {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.install-actions button.primary { background: #66e0ff; color: #0d083b; }

/* Short landscape phone screens: tighten the loading screen to make room */
@media (max-height: 480px) {
  #loading-screen { gap: 8px; }
  #loading-logo { width: 56px; height: 56px; border-radius: 13px; }
  #loading-title { font-size: 16px; }
  .install-icon { display: none; }
  .install-card { padding: 14px 16px; }
}

/* Error / warning banners */
#unity-warning {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  display: none;
  z-index: 40;
}
.banner-error, .banner-warning {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}
.banner-error { background: #c62828; color: #fff; }
.banner-warning { background: #ffd54f; color: #111; }

#diagnostics-icon {
  display: none;
  position: fixed;
  right: calc(8px + env(safe-area-inset-right, 0px));
  bottom: 8px;
  z-index: 50;
}
