@font-face {
  font-family: "Montserrat";
  font-weight: 700;
  font-display: block;
  src: url("Montserrat-Bold.ttf") format("truetype");
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1e1e1e;
}

/* L'app occupa tutta l'area del browser (non lo schermo intero del monitor). */
#unity-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

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

/* ---- Schermata di caricamento: stessa grafica del menu principale ---- */
#mt-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3.5vh, 40px);
  padding: 0 16px;
  box-sizing: border-box;
  background: url("sfondo-blu.png") center / cover no-repeat, #2a3170;
  font-family: "Montserrat", Arial, sans-serif;
  font-weight: 700;
  color: #29abe2;
  text-align: center;
  user-select: none;
  transition: opacity 0.6s ease;
  z-index: 10;
}

/* Disegni bianchi sullo sfondo, alpha 0.165 come nel LoginCanvas. */
#mt-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("sfondo-disegni.png") center / cover no-repeat;
  opacity: 0.165;
  pointer-events: none;
}

#mt-loading.mt-hidden {
  opacity: 0;
  pointer-events: none;
}

#mt-loading > * {
  position: relative;
}

#mt-logo {
  width: min(60vw, 78vh, 900px);
  height: auto;
}

#mt-subtitle {
  margin: 0;
  font-size: clamp(16px, 2.6vw, 34px);
  line-height: 1.2;
}

#mt-progress {
  width: min(70vw, 560px);
}

#mt-progress-track {
  height: clamp(10px, 1.4vh, 16px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

#mt-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: #29abe1;
  transition: width 0.25s ease-out;
}

#mt-progress-label {
  margin-top: 10px;
  font-size: clamp(12px, 1.4vw, 18px);
  color: #fff;
  letter-spacing: 0.08em;
}

/* ---- Telefono in verticale: si chiede di ruotarlo (classe mt-mobile messa dall'index.html) ---- */
#mt-rotate {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 32px;
  box-sizing: border-box;
  background: url("sfondo-blu.png") center / cover no-repeat, #2a3170;
  font-family: "Montserrat", Arial, sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  text-align: center;
  user-select: none;
}

#mt-rotate svg {
  width: 96px;
  height: 96px;
  color: #29abe2;
  animation: mt-rotate-hint 2s ease-in-out infinite;
}

#mt-rotate p {
  margin: 0;
}

#mt-rotate .mt-rotate-hint {
  margin-top: -12px;
  max-width: 280px;
  font-size: 14px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
}

@keyframes mt-rotate-hint {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

@media (orientation: portrait) {
  .mt-mobile #mt-rotate {
    display: flex;
  }
}

/* ---- Da telefono, dopo un crash o un errore di caricamento: si propone l'app (vedi index.html) ---- */
#mt-crash {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 40;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 32px;
  box-sizing: border-box;
  background: url("sfondo-blu.png") center / cover no-repeat, #2a3170;
  font-family: "Montserrat", Arial, sans-serif;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

#mt-crash.mt-visible {
  display: flex;
}

#mt-crash p {
  margin: 0;
  max-width: 460px;
}

#mt-crash .mt-crash-title {
  font-size: 22px;
  color: #29abe2;
}

#mt-crash .mt-crash-text {
  font-size: 15px;
  line-height: 1.45;
}

#mt-crash .mt-crash-button {
  margin-top: 8px;
  padding: 14px 32px;
  border-radius: 999px;
  background: #f7941d;
  color: #fff;
  font-size: 18px;
  text-decoration: none;
}

#mt-crash .mt-crash-retry {
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
}

#mt-crash .mt-crash-detail {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  word-break: break-word;
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
  z-index: 20;
  font-family: Arial, sans-serif;
}
