:root {
  --fondo: #0B1E2D;
  --fondo-2: #121F3A;
  --tinta: #F2EEFF;
  --gris: #AEB8CC;
  --acento: #B58CFF;
  --acento-fuerte: #8B5CF6;
  --sobre-acento: #1A0B33;
  --panel: rgba(10, 16, 34, 0.84);
  --borde: rgba(196, 160, 255, 0.3);
  --fuente: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --arriba: env(safe-area-inset-top, 0px);
  --abajo: env(safe-area-inset-bottom, 0px);
  --lupa: min(40vw, 168px);
}
* { box-sizing: border-box }
html, body { margin: 0; height: 100%; background: var(--fondo); color: var(--tinta); font-family: var(--fuente); overflow: hidden; -webkit-text-size-adjust: 100% }
/* El motor llama a renderer.setSize() de three.js con el tamaño del búfer (pantalla × densidad), y three.js lo copia
   al estilo del lienzo: en un teléfono (densidad 2 o 3) el lienzo quedaría 2 o 3 veces más grande que la pantalla.
   El tamaño en pantalla lo manda esta regla. touch-action: none deja los gestos (girar, pellizcar) a la escena. */
#lienzo { position: fixed; inset: 0; width: 100vw !important; height: 100vh !important; height: 100dvh !important; display: block; touch-action: none }
#capa { position: fixed; inset: 0; pointer-events: none }
#capa > * { pointer-events: auto }
.oculto { display: none !important }

.boton { display: block; width: 100%; min-height: 54px; border: 0; border-radius: 27px; font: 800 19px var(--fuente); cursor: pointer; padding: 12px 20px; margin-top: 12px }
.boton.principal { background: var(--acento); color: var(--sobre-acento); box-shadow: 0 6px 0 #6D3FD1 }
.boton.principal:active { transform: translateY(3px); box-shadow: 0 3px 0 #6D3FD1 }
.boton.secundario { background: rgba(255, 255, 255, 0.1); color: var(--tinta); border: 1.5px solid var(--borde) }
.boton:disabled { opacity: 0.85 }
/* Cuando la animación del paso terminó, «Siguiente» llama la atención. */
.boton.principal.listo { animation: llamar 1.3s ease-in-out infinite }
@keyframes llamar { 50% { box-shadow: 0 6px 0 #6D3FD1, 0 0 0 6px rgba(181, 140, 255, 0.35) } }
.sub { color: var(--gris); font-size: 17px; line-height: 1.4; margin: 8px 0 }

/* Inicio */
.pantalla { position: absolute; inset: 0; overflow-y: auto; background: radial-gradient(120% 70% at 50% 18%, #2A1F5C 0%, var(--fondo) 62%); padding: calc(14px + var(--arriba)) 22px calc(22px + var(--abajo)); display: flex; flex-direction: column; align-items: center; text-align: center }
.portada { width: min(58vw, 240px); height: auto; aspect-ratio: 3 / 4; object-fit: contain; filter: drop-shadow(0 0 22px rgba(181, 140, 255, 0.4)) }
.pantalla h1 { margin: 6px 0 0; font-size: 34px; line-height: 1.1; font-weight: 900; letter-spacing: -0.5px; background: linear-gradient(90deg, #E5D6FF, var(--acento)); -webkit-background-clip: text; background-clip: text; color: transparent }
.pantalla .sub, .pantalla .boton, .cartel-mini { max-width: 420px }
.cartel-mini { display: flex; gap: 14px; align-items: center; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--borde); border-radius: 18px; padding: 12px; margin: 12px 0 4px; text-align: left }
.cartel-mini img { width: 64px; height: auto; border-radius: 6px }
.cartel-mini figcaption { font-size: 16px; font-weight: 700; line-height: 1.3 }
.nota { font-size: 14px; color: var(--gris); margin-top: 14px; max-width: 420px }
.preparando { margin: 8px 0 0; min-height: 20px; font-size: 14px; font-weight: 700; opacity: 0.8 }
/* Créditos que piden las licencias (8th Wall y los modelos). El logo de 8th Wall es blanco. */
.creditos { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px auto 0; max-width: 420px; font-size: 11px; line-height: 1.4; color: var(--gris) }
.creditos img { height: 14px; width: auto }
.creditos a { color: inherit }

/* Buscando el cartel */
.aviso-camara { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(78vw, 300px); text-align: center }
.aviso-camara .marco { width: 58%; margin: 0 auto; padding: 8px; border: 3px solid var(--acento); border-radius: 16px; animation: latir 1.6s ease-in-out infinite }
.aviso-camara .marco img { width: 100%; display: block; border-radius: 8px; opacity: 0.9 }
.aviso-camara p { margin: 14px 0 0; font-weight: 800; font-size: 18px; background: var(--panel); border-radius: 14px; padding: 10px 12px }
@keyframes latir { 50% { transform: scale(1.05); border-color: #E5D6FF } }

/* El reloj: cuánto tiempo ha pasado desde que se tomó */
.reloj { position: fixed; left: 12px; top: calc(10px + var(--arriba)); margin: 0; display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--borde); border-radius: 999px; padding: 6px 12px 6px 9px; font-weight: 900; font-size: 17px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none !important }
.reloj svg { color: var(--acento) }
.reloj small { font-size: 11px; font-weight: 700; color: var(--gris); max-width: 72px; line-height: 1.1 }

/* La lupa: WebGL dibuja dentro del círculo; aquí solo va el borde, el letrero y la línea al órgano */
/* El botón de la voz, arriba a la derecha (la bocina con ondas o tachada). */
.boton-voz { position: fixed; right: 12px; top: calc(10px + var(--arriba)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--borde); background: var(--panel); color: var(--tinta); display: grid; place-items: center; padding: 0; cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px) }
.boton-voz .tache { display: none }
.boton-voz[aria-pressed="false"] .ondas { display: none }
.boton-voz[aria-pressed="false"] .tache { display: inline }
.boton-voz[aria-pressed="false"] { color: var(--gris) }
.lupa { position: fixed; right: 12px; top: calc(62px + var(--arriba)); width: var(--lupa); height: var(--lupa); border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 2px rgba(181, 140, 255, 0.85), 0 10px 28px rgba(0, 0, 0, 0.35); pointer-events: none !important; animation: abrir 0.35s ease-out }
@keyframes abrir { from { transform: scale(0.6); opacity: 0 } }
/* El letrero va montado sobre el borde de abajo del círculo, para ocupar poco. */
.lupa-texto { position: fixed; right: calc(12px + var(--lupa) * 0.08); top: calc(62px + var(--arriba) + var(--lupa) - 16px); width: calc(var(--lupa) * 0.84); margin: 0; text-align: center; font-size: 11.5px; font-weight: 800; line-height: 1.2; color: var(--sobre-acento); background: var(--acento); border: 2px solid #fff; border-radius: 10px; padding: 4px 6px; pointer-events: none !important }
.lupa-linea { position: fixed; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none !important }
.lupa-linea line { stroke: rgba(255, 255, 255, 0.9); stroke-width: 2; stroke-dasharray: 5 5 }
.lupa-linea circle { fill: var(--acento); stroke: #fff; stroke-width: 2 }

/* El relato de cada paso, abajo */
.relato { position: fixed; left: 0; right: 0; bottom: 0; max-height: 52vh; overflow-y: auto; background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--borde); border-radius: 22px 22px 0 0; padding: 12px 16px calc(10px + var(--abajo)); animation: subir 0.3s ease-out }
@keyframes subir { from { transform: translateY(30px); opacity: 0 } }
/* El número del paso, en una pastilla junto al título («3/7»). */
.paso { display: inline-block; margin-right: 8px; padding: 3px 9px; border-radius: 14px; background: var(--acento); color: var(--sobre-acento); font-size: 15px; font-weight: 900; line-height: 20px; vertical-align: 3px }
.relato h2 { margin: 0; font-size: 23px; font-weight: 900; line-height: 1.2 }
.texto { margin: 6px 0 2px; font-size: 15.5px; line-height: 1.4 }
.lista { margin: 6px 0; padding-left: 0; list-style: none; font-size: 16px; line-height: 1.5 }
.lista li { padding-left: 26px; position: relative }
.lista li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 13px; height: 7px; border-left: 3px solid var(--acento); border-bottom: 3px solid var(--acento); transform: rotate(-45deg) }
.fila { display: flex; gap: 8px; margin-top: 8px }
.fila.deslizable { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px }
.fila.deslizable::-webkit-scrollbar { display: none }
.fila:empty { display: none }
.chip { flex: 0 0 auto; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--borde); background: rgba(22, 20, 48, 0.9); color: var(--tinta); font: 800 15px var(--fuente); padding: 8px 14px; cursor: pointer }
.chip.activo { background: var(--acento); border-color: var(--acento); color: var(--sobre-acento) }
.curva { display: block; width: 100%; height: 138px; margin-top: 8px }
.curva.compacta { height: 58px; margin-top: 6px }
.consejo { margin: 8px 0 0; font-size: 14.5px; line-height: 1.38; font-weight: 700; background: rgba(181, 140, 255, 0.13); border-left: 4px solid var(--acento); border-radius: 4px 12px 12px 4px; padding: 8px 10px }
.mas { margin-top: 4px; font-size: 14px; line-height: 1.4 }
.mas summary { cursor: pointer; font-weight: 800; color: var(--acento); padding: 6px 0 2px }
.mas p { margin: 4px 0 }
.mas:not(:has(#relato-dato:not(:empty))) { display: none }
.fuente { font-size: 12px; color: var(--gris) }
.navegar { display: flex; gap: 10px; margin-top: 2px }
.navegar .boton { margin-top: 8px; min-height: 50px }
.navegar .boton.secundario { flex: 0 0 58px; font-size: 26px; line-height: 1; padding: 0 }
.navegar .boton.principal { flex: 1 1 auto }
.aviso-salud { margin: 8px 0 0; font-size: 11px; color: var(--gris) }

/* Sin cámara */
.hoja { position: fixed; inset: 0; background: rgba(4, 8, 18, 0.7); display: flex; align-items: flex-end; justify-content: center; padding: 16px }
.tarjeta-hoja { width: 100%; max-width: 460px; background: var(--fondo-2); border: 1px solid var(--borde); border-radius: 22px; padding: 20px; margin-bottom: var(--abajo) }
.tarjeta-hoja h2 { margin: 0 0 6px }

/* ?debug=1: panel con lo que pasa por dentro. */
.depuracion { position: fixed; z-index: 1000; left: 6px; right: 6px; top: calc(48px + env(safe-area-inset-top)); margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.62); color: #fff; font: 11px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; pointer-events: none }

/* Candado de lugar: la farmacia del cartel en el inicio y la hoja cuando no se puede jugar aquí. */
.lugar { margin: 2px 0 8px; font-size: 15px; line-height: 1.35; max-width: 420px }
.lugar b { font-weight: 900 }
.lugar.demo { padding: 4px 12px; border-radius: 14px; background: #FFC23C; color: #18212B; font-weight: 800 }
.candado-negocio { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--borde) }
.candado-negocio p { margin: 0; font-weight: 800 }
.boton.whatsapp { display: flex; align-items: center; justify-content: center; box-sizing: border-box; text-decoration: none; text-align: center; background: #FFC23C; color: #18212B; font-size: 17px }
