.pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pwa-modal.hidden { display: none !important; }

.pwa-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.pwa-modal-panel {
  position: relative;
  background: linear-gradient(160deg, #1a0a2e, #2d1b4e);
  border: 2px solid #8b5cf6;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  color: #e9d5ff;
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.45);
}

.pwa-modal-icon {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 18px;
  border: 2px solid #7c3aed;
  margin-bottom: 14px;
}

.pwa-modal-panel h2 {
  color: #c4b5fd;
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.pwa-modal-desc {
  font-size: 0.95rem;
  color: #a78bfa;
  margin-bottom: 16px;
  line-height: 1.45;
}

.pwa-steps {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: #ddd6fe;
}

.pwa-steps ol {
  margin: 8px 0 0 18px;
  line-height: 1.6;
}

.pwa-modal-msg {
  color: #fca5a5;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.pwa-install-progress {
  margin: 8px 0 16px;
}

.pwa-progress-label {
  font-size: 0.92rem;
  color: #c4b5fd;
  margin-bottom: 12px;
}

.pwa-progress-track {
  height: 12px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.pwa-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa, #7c3aed);
  background-size: 200% 100%;
  animation: pwa-progress-shine 1.2s linear infinite;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.pwa-progress-percent {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #a78bfa;
  font-weight: 600;
}

.pwa-progress-hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #ddd6fe;
  line-height: 1.45;
}

@keyframes pwa-progress-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pwa-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-btn {
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.pwa-btn-primary {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
}

.pwa-btn-ghost {
  background: transparent;
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

body.pwa-blocked #login-screen,
body.pwa-blocked .auth-page,
body.pwa-blocked .auth-box,
body.pwa-blocked #login-screen * {
  pointer-events: none;
  filter: grayscale(0.35) brightness(0.65);
}

body.pwa-blocked #pwa-install-modal {
  pointer-events: all;
  filter: none;
}

/* PWA — tela cheia imersiva */
html.pwa-immersive,
html.pwa-immersive body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

html.pwa-immersive #renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Paisagem forçada em retrato — somente durante o jogo */
@media (orientation: portrait) {
  html.game-mode.force-landscape {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vh;
    height: 100vw;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
    overflow: hidden;
  }

  html.game-mode.force-landscape body {
    width: 100vh;
    height: 100vw;
    overflow: hidden;
  }
}

@media (display-mode: fullscreen), (display-mode: standalone) {
  html, body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #0a0a2e;
  }
}

html.pwa-immersive #app-splash,
html.pwa-immersive #login-screen,
html.pwa-immersive #renderCanvas {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
