html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #251D35;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* The game stays inside the iPhone safe area (notch, Dynamic Island, home bar). */
#frame {
  position: fixed;
  top: env(safe-area-inset-top);
  right: env(safe-area-inset-right);
  bottom: env(safe-area-inset-bottom);
  left: env(safe-area-inset-left);
  background: linear-gradient(#3B2A57, #17111F);
}

#unity-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 40%, #4A3270, #17111F 70%);
  color: #FFF7F0;
  z-index: 2;
}

#loading-logo {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#loading-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(#FFE3A8, #B98A3E);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#loading-bar {
  width: 220px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 247, 240, 0.15);
  overflow: hidden;
}

#loading-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #E8BE75, #F3C8D5);
  transition: width 0.2s;
}

#loading-text {
  font-size: 15px;
  opacity: 0.7;
}

#error {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: #251D35;
  color: #FFF7F0;
  font-size: 18px;
  z-index: 3;
}

/* "display: flex" above would otherwise override the hidden attribute and cover the game. */
#error[hidden] {
  display: none;
}
