* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #1a1030;
  --accent: #ffd166;
  --pink: #ff8fc7;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  color: #fff;
  user-select: none;
}

#cam, #scene {
  position: fixed;
  inset: 0;
  width: 100vw; height: 100vh;
  object-fit: cover;
}

/* Cámara trasera: NO espejar */
#cam { z-index: 0; }
#scene { z-index: 1; background: transparent; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: 0; right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px;
  pointer-events: none;
}

#gesture-chip, #status-chip {
  background: rgba(26, 16, 48, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 209, 102, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

/* dom-overlay de WebXR */
#overlay { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#overlay #hud {
  position: absolute; top: env(safe-area-inset-top, 12px);
  left: 0; right: 0; display: flex; justify-content: center; padding: 14px;
}
#status-chip { display: flex; align-items: center; gap: 9px; }

#debug {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 14px);
  left: 12px; right: 12px;
  margin: 0;
  background: rgba(10,6,20,0.82);
  color: #9dffbf;
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  pointer-events: none;
}

/* punto de estado del escaneo */
#scan-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: #ffb703;               /* buscando (ámbar, parpadea) */
  box-shadow: 0 0 0 0 rgba(255,183,3,0.6);
  animation: scanPulse 1.1s infinite;
}
#status-chip.found #scan-dot {       /* piso detectado (verde fijo) */
  background: #3ddc84; animation: none; box-shadow: 0 0 8px rgba(61,220,132,0.9);
}
#status-chip.found { border-color: rgba(61,220,132,0.6); }

@keyframes scanPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,183,3,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255,183,3,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,183,3,0); }
}

#speech {
  max-width: 80%;
  background: #fff;
  color: #2a1b3d;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  animation: pop 0.25s ease;
}
#speech::after {
  content: "";
  position: absolute;
  bottom: -8px; left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}
#speech { position: relative; }
.hidden { display: none !important; }

@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- Barra de personajes ---------- */
#char-bar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 16px);
  left: 0; right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 16px;
}
.char-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(26, 16, 48, 0.6);
  backdrop-filter: blur(8px);
  font-size: 26px;
  transition: transform 0.15s, border-color 0.15s;
}
.char-btn.active {
  border-color: var(--accent);
  transform: scale(1.12);
}

/* ---------- Pantalla de inicio ---------- */
#start-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 30%, #2e1a52, #140b26);
}
#start-screen h1 {
  font-size: 42px;
  letter-spacing: 1px;
}
#start-screen h1 span {
  color: var(--accent);
}
#start-screen p {
  max-width: 320px;
  opacity: 0.85;
  line-height: 1.5;
}
#start-btn {
  margin-top: 6px;
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--accent));
  color: #2a1b3d;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(255, 143, 199, 0.4);
}
#start-screen small { opacity: 0.55; max-width: 300px; }
