:root {
  --fondo: #15163A;
  --texto: #FFFFFF;
  --acento: #FFD23F;
  --coral: #FF5D73;
  --cian: #3EC1D3;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#escena { position: fixed; inset: 0; }
/* MindAR mete el vídeo y el canvas aquí: que ocupen la pantalla entera */
#escena video, #escena canvas { position: absolute !important; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.panel {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
}
.panel.visible { opacity: 1; visibility: visible; }
.panel p { margin: 0; font-size: 20px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.panel small { max-width: 320px; font-size: 14px; opacity: .85; text-shadow: 0 1px 6px rgba(0,0,0,.7); }

#cargando { background: var(--fondo); }
.girando {
  width: 54px; height: 54px; border-radius: 50%;
  border: 6px solid rgba(255,255,255,.15); border-top-color: var(--acento); border-right-color: var(--coral);
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* Visor mientras busca la tarjeta */
.visor {
  position: relative; width: min(62vw, 300px); aspect-ratio: 3 / 4; border-radius: 22px;
  border: 3px solid rgba(255,255,255,.9); box-shadow: 0 0 0 200vmax rgba(10,10,30,.25); overflow: hidden;
}
.visor img { width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.barrido {
  position: absolute; left: 0; right: 0; height: 30%;
  background: linear-gradient(to bottom, transparent, rgba(255,210,63,.55), transparent);
  animation: barrer 1.8s ease-in-out infinite;
}
@keyframes barrer { 0% { top: -30%; } 100% { top: 100%; } }

.pildora {
  position: absolute; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: rgba(21,22,58,.82); border: 2px solid var(--acento); border-radius: 999px; padding: 10px 18px;
  font-weight: 800; font-size: 16px; opacity: 0; transition: opacity .4s, transform .4s; white-space: nowrap;
}
.pildora.visible { opacity: 1; transform: translate(-50%, 0); }

#error { background: var(--fondo); pointer-events: auto; }
#error button {
  margin-top: 8px; font: inherit; font-weight: 800; font-size: 18px; color: var(--fondo); background: var(--acento);
  border: 0; border-radius: 14px; padding: 14px 22px;
}
