* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; color: #eee;
  font-family: "Impact", "Arial Black", system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}

/* Solo <html> negro: si <body> tiene fondo, tapa el <video> de MindAR (z-index: -2) */
html { background: #000; }
body { background: transparent; }

#scene { position: fixed !important; inset: 0; width: 100vw !important; height: 100vh !important; }

/* MindAR mete su <video> en el body: que llene la pantalla */
body > video:not(#testVideo) { object-fit: cover; }

#testVideo {
  display: none; position: fixed; inset: 0; width: 100vw; height: 100vh;
  object-fit: cover; z-index: 0;
}
body.test #testVideo { display: block; }
body.test #scene { z-index: 1; }   /* NPC 3D encima del video de prueba */

/* Overlay 2D del juego (mira, efectos, flechas) */
#game { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }

.hidden { display: none !important; }

#hud {
  position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 10px;
  display: flex; gap: 8px; z-index: 20;
}
.hud-box {
  background: rgba(20, 0, 0, .65); border: 2px solid #8b0000;
  padding: 6px 12px; border-radius: 6px; font-size: 22px; letter-spacing: 1px;
}


#controls {
  position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 24px; z-index: 20; pointer-events: none;
}
#stick-base {
  pointer-events: auto; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.08), rgba(0,0,0,.45));
  border: 3px solid rgba(180, 20, 20, .8); position: relative; touch-action: none;
}
#stick-knob {
  position: absolute; left: 50%; top: 50%; width: 60px; height: 60px;
  margin: -30px 0 0 -30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d33, #600);
  border: 2px solid #f66; box-shadow: 0 0 12px rgba(255,0,0,.6);
}
#fireBtn {
  pointer-events: auto; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4b2b, #7a0000);
  border: 4px solid #ffb199; color: #fff; font-family: inherit; font-size: 20px;
  letter-spacing: 1px; box-shadow: 0 0 20px rgba(255, 60, 0, .6); touch-action: none;
}
#fireBtn.down { transform: scale(.92); filter: brightness(1.3); }

.screen {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  background: radial-gradient(circle, rgba(60,0,0,.85), rgba(0,0,0,.95));
}
.screen h1 { font-size: 46px; margin: 0 0 12px; color: #e11; text-shadow: 0 0 18px #900, 2px 2px 0 #000; letter-spacing: 2px; }
.screen p { font-family: system-ui, sans-serif; font-size: 18px; max-width: 420px; line-height: 1.4; }
.screen .small { font-size: 14px; opacity: .7; }
#endMessage { font-size: 20px; color: #fff; white-space: pre-line; }
.big-btn {
  margin-top: 16px; padding: 16px 40px; font-size: 26px; font-family: inherit; letter-spacing: 2px;
  color: #fff; background: linear-gradient(#c00, #600); border: 3px solid #f55; border-radius: 8px;
  box-shadow: 0 0 20px rgba(255,0,0,.5);
}

.hint {
  position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 15;
  background: rgba(0,0,0,.65); padding: 12px 20px; border-radius: 8px;
  font-family: system-ui, sans-serif; font-size: 18px;
}

#countdown {
  position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center;
  font-size: 140px; color: #e11; text-shadow: 0 0 30px #900, 4px 4px 0 #000; pointer-events: none;
}

/* Hint del showcase: pulso suave, no bloquea el toque al modelo */
#tapHint { width: max-content; max-width: 92vw; text-align: center; top: auto; bottom: calc(env(safe-area-inset-bottom) + 40px); pointer-events: none; animation: pulse 1.4s ease-in-out infinite; }
#scanHint { pointer-events: none; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.08); opacity: .75; } }

/* Pantalla final: transparente arriba para que se vea el modelo sobre la carta */
#endScreen {
  justify-content: flex-end; padding-bottom: calc(env(safe-area-inset-bottom) + 32px);
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(40,0,0,.7) 45%, transparent 70%);
  pointer-events: none;
}
#endScreen .big-btn { pointer-events: auto; }

/* Título sobre el video de la cámara (sin botón en modo AR) */
#startScreen {
  justify-content: flex-start; padding-top: calc(env(safe-area-inset-top) + 48px);
  background: linear-gradient(to bottom, rgba(40,0,0,.85) 0%, rgba(0,0,0,.45) 40%, transparent 65%);
  pointer-events: none;
}
#startScreen .big-btn { pointer-events: auto; }
