:root {
  --fondo: #04060b; --tinta: #eaf6ff; --gris: #8fb4c8; --oro: #ffc46b; --cian: #5ce1ff; --verde: #3ddc97;
  --vidrio: rgba(8, 13, 24, .72); --borde: rgba(255, 255, 255, .09);
  --serif: Georgia, "Times New Roman", serif; --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --seguro-ab: env(safe-area-inset-bottom, 0px); --seguro-ar: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); color: var(--tinta); font-family: var(--sans); overflow: hidden;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cian); outline-offset: 2px; }

#fundido { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .55s ease; z-index: 30; }
#fundido.on { opacity: 1; }

/* barra superior */
#barra { position: fixed; top: calc(10px + var(--seguro-ar)); left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; z-index: 20; pointer-events: none; }
#barra > * { pointer-events: auto; }
.marca { display: flex; flex-direction: column; line-height: 1; text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.marca-m { font-family: var(--serif); font-size: 24px; letter-spacing: .5px; }
.marca-sub { font-size: 11px; color: var(--gris); letter-spacing: 1.6px; text-transform: uppercase; margin-top: 4px; }
.pastilla { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--vidrio);
  border: 1px solid var(--borde); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; font-variant-numeric: tabular-nums; }
.pastilla.tenue { color: var(--gris); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: #66717f; box-shadow: 0 0 0 0 rgba(61,220,151,.6); }
.vivo-on .punto { background: var(--verde); animation: latido 2s infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(61,220,151,.55); } 70% { box-shadow: 0 0 0 9px rgba(61,220,151,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,151,0); } }

.panel { position: fixed; top: calc(58px + var(--seguro-ar)); right: 16px; z-index: 21; padding: 14px 16px; border-radius: 16px; background: var(--vidrio);
  border: 1px solid var(--borde); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: grid; grid-template-columns: repeat(3, auto); gap: 6px 18px; }
.cifra { display: flex; flex-direction: column; }
.cifra span { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cifra small { font-size: 11px; color: var(--gris); }
.panel .nota { grid-column: 1 / -1; margin: 4px 0 0; }

#cartelCeremonia { position: fixed; top: calc(58px + var(--seguro-ar)); left: 50%; transform: translateX(-50%); z-index: 22; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 16px; border-radius: 999px; background: rgba(24, 18, 6, .86); border: 1px solid rgba(255,196,107,.45); font-size: 14px; white-space: nowrap;
  animation: entra .5s ease; max-width: calc(100vw - 32px); }
#cartelCeremonia button { background: var(--oro); color: #1a1306; font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.dorado { color: var(--oro); }
@keyframes entra { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* capas a pantalla completa */
.capa { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 90% at 50% 30%, rgba(8,14,28,.55), rgba(2,3,7,.92)); }
.centro { max-width: 520px; text-align: center; }
.logo { font-family: var(--serif); font-size: 56px; letter-spacing: 1px; }
.sub { color: var(--gris); margin: 6px 0 22px; }
.progreso { width: 220px; height: 3px; margin: 0 auto; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
#cargaBarra { height: 100%; width: 0; background: linear-gradient(90deg, var(--cian), var(--oro)); transition: width .3s ease; }
.antetitulo { font-size: 12px; letter-spacing: 2px; color: var(--oro); text-transform: uppercase; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 9vw, 64px); margin: 14px 0 12px; line-height: 1.05; }
h1 em { font-style: italic; color: var(--oro); }
h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 6px 0 10px; }
.lema { color: #c7d7e2; font-size: 17px; line-height: 1.5; margin: 0 0 26px; }
.nota { color: var(--gris); font-size: 12.5px; margin: 14px 0 0; }
.boton { background: var(--tinta); color: #06101a; font-weight: 700; padding: 13px 22px; border-radius: 999px; letter-spacing: .2px; transition: transform .15s ease, background .2s; }
.boton:active { transform: scale(.97); }
.boton.grande { padding: 16px 44px; font-size: 17px; background: var(--oro); color: #1a1306; }
.redondo { width: 44px; height: 44px; border-radius: 50%; background: var(--vidrio); border: 1px solid var(--borde); font-size: 22px; display: grid; place-items: center; }
.enlace { color: var(--gris); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 6px; }

/* hojas inferiores (móvil primero) */
.hoja { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--seguro-ab)); z-index: 24; padding: 16px 18px 18px; border-radius: 22px;
  background: var(--vidrio); border: 1px solid var(--borde); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: sube .35s ease;
  max-height: 62vh; overflow: auto; }
@keyframes sube { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (min-width: 761px) { .hoja { left: auto; right: 24px; bottom: 24px; width: 400px; } }
#elegir { text-align: center; }
.selector { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 4px 0 14px; color: var(--gris); font-variant-numeric: tabular-nums; }
.etiqueta { display: block; text-align: left; font-size: 13px; color: var(--gris); margin-bottom: 6px; }
.etiqueta small { color: #6c8494; }
#alias { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--borde); background: rgba(0,0,0,.35); color: var(--tinta); font-size: 16px; margin-bottom: 14px; }
#btnPasear { width: 100%; }

/* HUD del paseo */
#hud { position: fixed; right: 16px; bottom: calc(18px + var(--seguro-ab)); z-index: 20; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#hud .boton { background: var(--oro); color: #1a1306; }
#reacciones { display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--vidrio); border: 1px solid var(--borde); }
#reacciones button { width: 40px; height: 40px; border-radius: 50%; font-size: 20px; transition: transform .12s ease, opacity .2s; }
#reacciones button:active { transform: scale(.88); }
#reacciones.espera button { opacity: .45; }
#zonaActual { position: fixed; left: 50%; transform: translateX(-50%); top: calc(58px + var(--seguro-ar)); z-index: 19; }
#joy { position: fixed; width: 120px; height: 120px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(8,13,24,.35); z-index: 19;
  display: none; pointer-events: none; }
#joy.on { display: block; }
#joyPomo { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: rgba(234,246,255,.85); }

/* tarjeta del recorrido */
.tarjeta-cab { display: flex; justify-content: space-between; align-items: center; }
#tarjeta p { margin: 0 0 10px; line-height: 1.5; color: #d2e0ea; font-size: 15px; }
#tarjeta .vivo { color: var(--cian); font-size: 13.5px; }
#tDiapo img { width: 100%; border-radius: 12px; display: block; margin: 4px 0 8px; background: #0a1220; }
.tarjeta-pie { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
#tPuntos { display: flex; gap: 7px; }
#tPuntos span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.2); }
#tPuntos span.on { background: var(--oro); }

/* recepción */
.respuesta { font-size: 15px; line-height: 1.5; color: #e2edf4; min-height: 44px; }
#rPreguntas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#rPreguntas button { padding: 9px 13px; border-radius: 999px; border: 1px solid var(--borde); background: rgba(255,255,255,.04); font-size: 13.5px; }

#toast { position: fixed; left: 50%; bottom: calc(110px + var(--seguro-ab)); transform: translateX(-50%); z-index: 26; padding: 10px 16px; border-radius: 12px;
  background: rgba(8,13,24,.86); border: 1px solid var(--borde); font-size: 14px; opacity: 0; transition: opacity .3s ease; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.on { opacity: 1; }
#creditos { position: fixed; left: 16px; bottom: calc(6px + var(--seguro-ab)); font-size: 10px; color: rgba(143,180,200,.55); z-index: 5; pointer-events: none; }
@media (max-width: 760px) { #creditos { display: none; } .marca-sub { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* networking: voz, chat y tarjetas */
#hud .fila { display: flex; gap: 8px; }
.redondo.activo { background: rgba(61,220,151,.25); border-color: rgba(61,220,151,.6); }
.redondo:disabled { opacity: .35; }
.redondo { position: relative; }
.globo { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--oro); color: #1a1306; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.globo:empty { display: none; }
.hablar { width: 100%; padding: 16px 18px; border-radius: 999px; background: var(--vidrio); border: 2px solid rgba(61,220,151,.6); color: var(--tinta); font-weight: 700; font-size: 15px;
  touch-action: none; -webkit-user-select: none; user-select: none; }
.hablar.hablando { background: var(--verde); color: #04140c; box-shadow: 0 0 0 6px rgba(61,220,151,.25); }
.politica { position: static; overflow: auto; }
.politica .centro { max-width: 40em; text-align: left; }
@media (max-width: 760px) { .llegada { top: calc(64px + env(safe-area-inset-top)) !important; } #escLineas div { white-space: normal; } .escaner { top: calc(108px + env(safe-area-inset-top)) !important; } }
.llegada { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 21; padding: 7px 16px;
  border-radius: 999px; background: rgba(4,10,18,.78); border: 1px solid rgba(255,196,107,.45); color: #fff4dc; font: 600 13px/1.2 system-ui, sans-serif; letter-spacing: .06em; }
.saltar { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 23; padding: 8px 14px; border-radius: 999px;
  background: rgba(4,10,18,.6); color: #cfe3ee; font-size: 13px; opacity: .8; }
#btnGuia.pulso { animation: pulso 1.1s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,196,107,.55); } 50% { box-shadow: 0 0 0 12px rgba(255,196,107,0); } }
.aviso-seg { max-width: 34em; margin: 10px auto 0; opacity: .85; }
.aviso-seg a { color: inherit; text-decoration: underline; }
.escaner { position: fixed; left: 16px; top: calc(70px + env(safe-area-inset-top)); z-index: 22; width: min(360px, calc(100vw - 32px));
  background: rgba(4,10,18,.92); border: 1px solid rgba(92,225,255,.45); border-radius: 14px; padding: 12px 14px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cfefff; box-shadow: 0 0 30px rgba(92,225,255,.18); }
.esc-cab { display: flex; justify-content: space-between; align-items: center; font: 600 11px/1 system-ui, sans-serif; letter-spacing: .12em; color: #5ce1ff; margin-bottom: 8px; }
#escLineas div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#escLineas b { color: #7fa9bd; font-weight: 500; display: inline-block; min-width: 6.5em; }
.esc-veredicto { margin: 8px 0 4px; font: 700 14px/1.3 system-ui, sans-serif; }
.esc-veredicto.bajo { color: #3ddc97; } .esc-veredicto.medio { color: #ffc46b; } .esc-veredicto.alto { color: #ff8a96; }
.pregBtn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 21; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
#pregForm { display: flex; gap: 8px; margin: 10px 0 4px; }
#pregForm .campo { flex: 1; min-width: 0; }
#pregTexto.pensando { opacity: .6; }
.hablar.mudo { border-color: rgba(255,138,150,.7); color: #ffb3bb; background: rgba(60,10,16,.55); }
#chatFeed { position: fixed; left: 16px; top: calc(100px + var(--seguro-ar)); z-index: 18; max-width: min(70vw, 340px); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#chatFeed .msg { background: rgba(8,13,24,.72); border: 1px solid var(--borde); border-radius: 12px; padding: 6px 10px; font-size: 13px; line-height: 1.35; word-break: break-word; transition: opacity 1s; }
#chatFeed .msg b { color: var(--oro); font-weight: 600; }
#chatFeed .msg.mio b { color: var(--verde); }
#chatFeed .msg.viejo { opacity: .45; }
#chatBar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--seguro-ab)); z-index: 23; display: flex; gap: 8px; padding: 8px; border-radius: 999px; background: var(--vidrio); border: 1px solid var(--borde); }
#chatBar input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--borde); background: rgba(0,0,0,.35); color: var(--tinta); font-size: 16px; }
@media (min-width: 761px) { #chatBar { left: 24px; right: auto; width: 420px; } }
.normas { margin: 4px 0 16px; padding-left: 18px; color: #d2e0ea; font-size: 14px; line-height: 1.5; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.secundario { padding: 12px 16px; border-radius: 999px; border: 1px solid var(--borde); background: rgba(255,255,255,.05); font-weight: 600; }
.secundario.peligro { color: #ff8a96; border-color: rgba(255,84,104,.4); }
.campo { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--borde); background: rgba(0,0,0,.35); color: var(--tinta); font-size: 16px; margin-bottom: 10px; }
#miTarjeta .boton, #normas .boton { width: 100%; }
#tjLista .tj { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--borde); margin-bottom: 8px; }
#tjLista .tj span { color: var(--gris); font-size: 13px; }
#tjLista .tj a { color: var(--cian); font-size: 13px; }
