html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: #060913;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#unity-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: min(540px, calc(100vh * (9 / 16)));
  max-height: min(960px, calc(100vw * (16 / 9)));
  aspect-ratio: 9 / 16;
  background: #050811;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 215, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  margin: auto;
}

@media (max-width: 600px) {
  #unity-container {
    width: 100%;
    height: 100%;
    max-width: calc(100vh * (9 / 16));
    max-height: calc(100vw * (16 / 9));
    aspect-ratio: 9 / 16;
    border-radius: 0;
    box-shadow: none;
    margin: auto;
  }
}

#unity-fullscreen-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
}

#unity-canvas {
  position: absolute;
  width: 100% !important;
  height: 100% !important;
  background: #050811;
  outline: none;
}

#unity-loading-container {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #060913 url('loading-bg.jpg') no-repeat center center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

#unity-loading-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(6, 11, 25, 0.70) 0%, rgba(3, 5, 12, 0.92) 100%);
  pointer-events: none;
}

#unity-loading-container.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#unity-loading-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 86%;
  max-width: 380px;
  text-align: center;
}

#game-logo {
  width: 250px;
  height: 170px;
  max-width: 75vw;
  background: url('game-logo.png') no-repeat center;
  background-size: contain;
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.45));
  animation: logoBreath 3s ease-in-out infinite alternate;
}

@keyframes logoBreath {
  0% {
    transform: scale(0.97);
    filter: drop-shadow(0 0 15px rgba(255, 190, 0, 0.35));
  }
  100% {
    transform: scale(1.02);
    filter: drop-shadow(0 0 35px rgba(255, 230, 60, 0.65));
  }
}

#loading-subtitle {
  color: #ffd875;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 6px;
  margin-bottom: 26px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 215, 0, 0.3);
}

#unity-progress-bar-empty {
  width: 100%;
  max-width: 280px;
  height: 16px;
  background: rgba(5, 10, 22, 0.88);
  border-radius: 10px;
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.25), inset 0 2px 5px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  position: relative;
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #d49a24 0%, #ffd700 50%, #ffae19 100%);
  border-radius: 8px;
  box-shadow: 0 0 14px #ffc800;
  transition: width 0.22s ease-out;
  position: relative;
  overflow: hidden;
}

#unity-progress-bar-full::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

#loading-percent {
  color: #ffd700;
  font-size: 14px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: 1px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
}

#loading-tip-container {
  margin-top: 32px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: rgba(8, 14, 28, 0.65);
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  backdrop-filter: blur(4px);
}

#loading-tip {
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
  font-style: italic;
  max-width: 320px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  transition: opacity 0.35s ease;
}

#unity-footer {
  display: none !important;
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: rgba(239, 68, 68, 0.9);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  z-index: 200;
}

/* ===================================================
   PWA & Mobile Install UI (Discreto & Elegante)
   =================================================== */

#pwa-install-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 11, 25, 0.82);
  border: 1px solid rgba(255, 215, 0, 0.55);
  border-radius: 20px;
  padding: 4px 8px 4px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 215, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#pwa-btn-install {
  background: transparent;
  border: none;
  color: #ffd700;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 2px 4px;
  outline: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

#pwa-btn-install:active {
  transform: scale(0.96);
}

#pwa-btn-dismiss {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 50%;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pwa-btn-dismiss:hover {
  color: #ef4444;
}

/* Modal de Instruções PWA / iOS */
#pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 17, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
}

#pwa-modal {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #0e172e 0%, #060a14 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 25px rgba(255, 215, 0, 0.25);
  padding: 20px;
  color: #f8fafc;
  box-sizing: border-box;
  animation: pwaModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaModalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.pwa-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  position: relative;
}

.pwa-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.pwa-modal-title-box h3 {
  margin: 0;
  font-size: 16px;
  color: #ffd700;
  letter-spacing: 0.5px;
}

.pwa-modal-title-box span {
  font-size: 11px;
  color: #94a3b8;
}

.pwa-modal-close {
  position: absolute;
  top: -4px;
  right: -4px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.pwa-modal-close:hover {
  color: #fff;
}

.pwa-modal-body {
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
  margin-bottom: 18px;
}

.pwa-modal-body strong {
  color: #ffd700;
}

.pwa-steps-list {
  padding-left: 20px;
  margin: 10px 0;
}

.pwa-steps-list li {
  margin-bottom: 8px;
}

.pwa-tip {
  margin-top: 12px;
  font-size: 12px;
  color: #e2e8f0;
  background: rgba(255, 215, 0, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.pwa-modal-footer {
  display: flex;
  justify-content: flex-end;
}

#pwa-modal-action-btn {
  background: linear-gradient(180deg, #ffd700 0%, #d49a24 100%);
  color: #060913;
  border: none;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 22px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
  transition: transform 0.1s ease;
}

#pwa-modal-action-btn:active {
  transform: scale(0.96);
}

