:root {
  --arena: #f3e7cf;
  --tinta: #2b2116;
  --oro: #d9a441;
  --oro-claro: #f6d488;
  --vida: #c8483c;
  --fe: #4f8fd6;
  --crec: #7fbf5a;
  --panel: rgba(28, 22, 15, 0.78);
  --borde: rgba(246, 212, 136, 0.45);
  font-family: Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1610; color: var(--arena);
  -webkit-user-select: none; user-select: none; touch-action: none; }
#lienzo { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.oculto { display: none !important; }

.pantalla { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(40, 30, 18, 0.55), rgba(10, 8, 5, 0.85)); z-index: 20; }
#carga { background: #1b1610; }
.caja-carga { width: min(420px, 100%); text-align: center; }
.caja-carga h1, .titulo-caja h1 { font-weight: normal; letter-spacing: 0.04em; color: var(--oro-claro); margin: 0 0 18px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.titulo-caja { text-align: center; }
.titulo-caja h1 { font-size: clamp(34px, 7vw, 68px); }
.subtitulo { margin: -8px 0 26px; font-style: italic; opacity: 0.85; }
.barra { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#carga-barra { height: 100%; width: 0; background: linear-gradient(90deg, var(--oro), var(--oro-claro)); transition: width 0.2s; }
#carga-texto { opacity: 0.75; font-size: 14px; }

.tarjeta { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid var(--borde);
  border-radius: 14px; padding: 22px 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); line-height: 1.5; }
.tarjeta.ancha { width: min(900px, 100%); }
.tarjeta h2 { margin: 0 0 12px; font-weight: normal; color: var(--oro-claro); }
.boton { font: inherit; color: var(--tinta); background: linear-gradient(var(--oro-claro), var(--oro)); border: 0; border-radius: 9px;
  padding: 10px 20px; cursor: pointer; margin: 8px 4px 0; box-shadow: 0 3px 0 #8a6421; }
.boton:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6421; }
.boton.grande { font-size: 19px; padding: 12px 30px; }
.boton.chico { font-size: 14px; padding: 6px 14px; background: rgba(255, 255, 255, 0.12); color: var(--arena); box-shadow: none; }
.boton.chico.activo { background: var(--oro); color: var(--tinta); }

.llamados { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 8px 0 14px; }
.llamado { border: 1px solid var(--borde); border-radius: 12px; padding: 12px; cursor: pointer; background: rgba(255, 255, 255, 0.04); }
.llamado.activo { background: rgba(217, 164, 65, 0.22); border-color: var(--oro-claro); }
.llamado .retrato { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; display: block; margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.3); }
.llamado h3 { margin: 0; color: var(--oro-claro); font-weight: normal; font-size: 21px; }
.llamado .sig { font-style: italic; opacity: 0.8; font-size: 13px; margin-bottom: 6px; }
.llamado p { margin: 4px 0; font-size: 14px; }
.figura { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.figura .boton { margin-top: 0; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.estado { position: absolute; left: 14px; top: 12px; display: flex; gap: 10px; align-items: center; }
.nivel { width: 58px; height: 58px; border-radius: 50%; background: var(--panel); border: 2px solid var(--oro); display: flex;
  flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.nivel span { font-size: 24px; color: var(--oro-claro); }
.nivel small { font-size: 9px; opacity: 0.85; margin-top: 2px; }
.barras { display: flex; flex-direction: column; gap: 4px; width: min(230px, 42vw); }
.barras > div { position: relative; height: 15px; background: rgba(0, 0, 0, 0.5); border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18); }
.barras > div > div { height: 100%; width: 100%; transition: width 0.25s; }
.barras span { position: absolute; left: 8px; top: -1px; font-size: 11px; text-shadow: 0 1px 2px #000; }
#hud-vida { background: linear-gradient(var(--vida), #8e2a22); }
#hud-fe { background: linear-gradient(var(--fe), #2c5e9c); }
.barras .barra-crec { height: 6px; }
#hud-crec { background: var(--crec); }

.minimapa { position: absolute; right: 14px; top: 12px; width: 170px; height: 170px; border-radius: 50%; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
@media (max-width: 600px) { .minimapa { width: 118px; height: 118px; } }
.mision { position: absolute; right: 196px; top: 12px; max-width: min(320px, 46vw); background: var(--panel); border: 1px solid var(--borde);
  border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.mision:empty { display: none; }
.mision .otras { display: block; font-size: 11px; opacity: 0.7; margin-top: 3px; }
.mision b { color: var(--oro-claro); font-weight: normal; display: block; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }

.dones { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px 8px;
  background: rgba(20, 15, 10, 0.55); border: 1px solid var(--borde); border-radius: 14px; }
.don.activo { border-color: var(--oro-claro); box-shadow: 0 0 12px rgba(246, 212, 136, 0.7) inset; }
.don.es-don { border-color: rgba(159, 198, 255, 0.55); }
.don { position: relative; width: 52px; height: 52px; border-radius: 12px; background: var(--panel); border: 1px solid var(--borde);
  display: flex; align-items: center; justify-content: center; font-size: 26px; overflow: hidden; }
.don .tecla { position: absolute; left: 4px; top: 2px; font-size: 11px; opacity: 0.8; font-family: sans-serif; }
.don .costo { position: absolute; right: 4px; bottom: 2px; font-size: 10px; color: #9cc6ff; font-family: sans-serif; }
.don .espera { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.6); height: 0; }
.don.sinfe { filter: grayscale(0.8) brightness(0.7); }
.don.bloqueado { opacity: 0.35; }

.indicacion { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--borde);
  padding: 7px 16px; border-radius: 20px; font-size: 15px; }
.indicacion kbd { font-family: sans-serif; background: var(--oro); color: var(--tinta); border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.aviso-centro { position: absolute; left: 0; right: 0; top: 26%; text-align: center; font-size: clamp(22px, 4vw, 38px); color: var(--oro-claro);
  text-shadow: 0 2px 10px #000; opacity: 0; transition: opacity 0.6s; }
.aviso-centro.ver { opacity: 1; }
.aviso-centro small { display: block; font-size: 0.5em; color: var(--arena); font-style: italic; margin-top: 6px; }
.aviso-centro small { max-width: min(760px, 92vw); margin: 8px auto 0; padding: 6px 14px; border-radius: 10px; background: rgba(20, 14, 8, 0.55);
  color: #fff4dc; font-size: max(0.5em, 17px); }
/* una cita sola (el final): grande, sobre una tarjeta oscura, con la referencia aparte */
.aviso-centro.cita { top: 22%; }
.aviso-centro .cita-texto { max-width: min(820px, 90vw); margin: 0 auto; padding: 22px 30px; border-radius: 14px; background: rgba(20, 14, 8, 0.78);
  border: 1px solid var(--borde); color: #fff4dc; font-style: italic; font-size: clamp(20px, 3vw, 30px); line-height: 1.4; }
.aviso-centro .cita-texto cite { display: block; margin-top: 12px; font-style: normal; font-size: 0.75em; color: var(--oro-claro); }

.dialogo { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(760px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; padding: 14px 18px 12px; pointer-events: auto; cursor: pointer; }
.dialogo .quien { color: var(--oro-claro); font-size: 15px; margin-bottom: 4px; }
.dialogo .texto { font-size: 18px; line-height: 1.45; min-height: 52px; }
.dialogo .cita { font-size: 13px; font-style: italic; opacity: 0.8; margin-top: 4px; }
.dialogo .cita:empty { display: none; }
.dialogo .opciones { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dialogo .opciones button { text-align: left; font: inherit; font-size: 16px; background: rgba(255, 255, 255, 0.08); color: var(--arena);
  border: 1px solid var(--borde); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.dialogo .opciones button:hover, .dialogo .opciones button.sel { background: rgba(217, 164, 65, 0.3); }
.dialogo .seguir { position: absolute; right: 14px; bottom: 6px; font-size: 12px; opacity: 0.7; animation: latir 1.2s infinite; }
@keyframes latir { 50% { opacity: 0.2; } }

.boton-pausa { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); pointer-events: auto; background: var(--panel); color: var(--arena);
  border: 1px solid var(--borde); border-radius: 8px; width: 40px; height: 32px; font-size: 13px; cursor: pointer; }
.controles { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14px; margin-bottom: 12px; }
.controles kbd { font-family: sans-serif; font-size: 12px; background: rgba(255, 255, 255, 0.14); border-radius: 4px; padding: 1px 6px; }
.opcion { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }
.opcion select, .opcion input { font: inherit; font-size: 14px; }
.nota-calidad { margin: -4px 0 8px; font-size: 13px; opacity: 0.8; }

.tactil { position: absolute; inset: 0; }
.palanca { position: absolute; left: 22px; bottom: 26px; width: 130px; height: 130px; border-radius: 50%; background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.25); pointer-events: auto; }
#palanca-punta { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(246, 212, 136, 0.6); }
.botones-tactiles { position: absolute; right: 14px; bottom: 84px; width: 210px; height: 200px; pointer-events: none; }
.bt { position: absolute; pointer-events: auto; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 22px; }
.bt.grande { width: 74px; height: 74px; right: 10px; bottom: 6px; font-size: 32px; }
.bt[data-t=saltar] { right: 96px; bottom: 0; }
.bt[data-t=rodar] { right: 92px; bottom: 62px; }
.bt[data-t=escudo] { right: 30px; bottom: 92px; }
.bt[data-t=usar] { right: 152px; bottom: 34px; }
.bt.don { width: 44px; height: 44px; font-size: 16px; bottom: 156px; }
.bt[data-t=don1] { right: 120px; } .bt[data-t=don2] { right: 66px; } .bt[data-t=don3] { right: 12px; }
body.tactil-activo .dones { display: none; }

.prologo { background: radial-gradient(ellipse at center, rgba(30, 20, 10, 0.55), rgba(5, 3, 2, 0.92)); flex-direction: column; }
.prologo-caja { max-width: 760px; text-align: center; }
.prologo-texto { font-size: clamp(20px, 3vw, 30px); line-height: 1.5; color: var(--arena); opacity: 0; transition: opacity 1.2s; margin: 0 0 18px; }
.prologo-cita { font-size: clamp(13px, 1.6vw, 17px); font-style: italic; color: var(--oro-claro); opacity: 0; transition: opacity 1.6s 0.6s; }
.prologo .ver { opacity: 1; }
.saltar { position: absolute; right: 18px; bottom: 18px; }
.velo { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.8s; z-index: 15; }
.velo.ver { opacity: 1; }
@media (max-width: 600px) {
  .mision { top: 140px; right: 10px; font-size: 12px; }
  .dialogo .texto { font-size: 16px; }
}

/* portada: todos los botones iguales (Continuar, Jugar / Empezar de nuevo, ES · EN, Volver a Verbo), uno debajo del otro */
.titulo-caja .boton.grande { display: block; box-sizing: border-box; width: min(320px, 82vw); margin: 10px auto 0; text-align: center;
  text-decoration: none; line-height: 1.25; }
.titulo-caja .boton.grande.oculto { display: none; }
.titulo-caja .idiomas { display: flex; gap: 10px; width: min(320px, 82vw); margin: 10px auto 0; }
.titulo-caja .idiomas .boton.grande { flex: 1; width: auto; margin: 0; opacity: 0.6; }
.titulo-caja .idiomas .boton.grande.activo { opacity: 1; outline: 2px solid var(--oro-claro); outline-offset: 2px; }

/* ---------- teléfono y tableta (2026-10-29) ---------- */
/* zonas seguras (muesca) */
.estado { left: calc(14px + env(safe-area-inset-left)); top: calc(12px + env(safe-area-inset-top)); }
.minimapa { right: calc(14px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); }
.palanca { left: calc(22px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); }
.botones-tactiles { right: calc(14px + env(safe-area-inset-right)); bottom: calc(84px + env(safe-area-inset-bottom)); }
/* el botón «✕» del entorno de Verbo va arriba a la izquierda: el estado se corre a su derecha */
html.mj-movil .estado { left: calc(52px + env(safe-area-inset-left)); }

.palanca { transition: transform 0.12s; }
.palanca.activa { transition: none; background: rgba(0, 0, 0, 0.32); }
.bt svg { width: 62%; height: 62%; display: block; margin: auto; pointer-events: none; }
.bt { display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.bt:active { background: rgba(246, 212, 136, 0.35); }
.bt .espera { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, 0.6); pointer-events: none; }
.bt.sinfe { filter: grayscale(0.8) brightness(0.7); }
.bt.bloqueado { display: none; }
body.hablando .tactil { display: none; }

/* con el dedo: botones y opciones más grandes, la misión y el aviso de «usar» se tocan */
body.tactil-activo .mision, body.tactil-activo .indicacion { pointer-events: auto; cursor: pointer; }
body.tactil-activo .op-mando { display: none; }
body.tactil-activo .boton-pausa { width: 46px; height: 40px; font-size: 15px; }
body.tactil-activo .dialogo .opciones button { min-height: 42px; }
body.tactil-activo .dialogo .seguir { font-size: 15px; }
html.mj-movil .boton.chico { min-height: 40px; padding: 8px 16px; }
html.mj-movil .opcion select { min-height: 36px; }
html.mj-movil .opcion input[type=range] { width: 46%; }
html.mj-movil .opcion input[type=checkbox] { width: 24px; height: 24px; }
html.mj-movil .barras span { font-size: 12px; top: 0; }
html.mj-movil .barras > div:not(.barra-crec) { height: 17px; }
html.mj-movil .nivel small { font-size: 11px; }
html.mj-movil .mision .otras { font-size: 13px; }

/* pantallas bajas (teléfono en horizontal) */
@media (max-height: 500px) {
  .pantalla { padding: 10px calc(12px + env(safe-area-inset-right)) 10px calc(12px + env(safe-area-inset-left)); }
  .tarjeta { padding: 14px 18px; }
  .tarjeta h2 { margin-bottom: 6px; font-size: 20px; }
  .titulo-caja h1 { font-size: 34px; margin-bottom: 10px; }
  .subtitulo { margin: -4px 0 8px; }
  .titulo-caja .boton.grande { margin-top: 7px; padding: 9px 24px; font-size: 17px; }
  .titulo-caja .idiomas { margin-top: 7px; }
  .llamados { grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 8px; }
  .llamado { padding: 8px; }
  .llamado .retrato { aspect-ratio: 2 / 1; object-position: 50% 18%; margin-bottom: 4px; }
  .llamado h3 { font-size: 17px; }
  .llamado p { font-size: 13px; line-height: 1.35; }
  .llamado p.sig { display: none; }
  .tarjeta.ancha .boton.grande { padding: 9px 24px; font-size: 17px; }
  .nivel { width: 50px; height: 50px; }
  .nivel span { font-size: 20px; }
  .barras { width: min(200px, 30vw); }
  .minimapa { width: 104px; height: 104px; }
  .mision { right: calc(130px + env(safe-area-inset-right)); top: 10px; max-width: min(280px, calc(50vw - 165px)); font-size: 13px; padding: 6px 10px; }
  .dialogo { bottom: 8px; padding: 10px 14px 8px; width: min(760px, calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  .dialogo .texto { font-size: 16px; min-height: 0; }
  .dialogo .opciones { flex-direction: row; flex-wrap: wrap; }
  .dialogo .opciones button { flex: 1 1 40%; font-size: 15px; }
  .indicacion { bottom: 30%; }
  .aviso-centro { top: 18%; }
  .aviso-centro .cita-texto { padding: 12px 18px; font-size: 18px; }
  .palanca { width: 116px; height: 116px; bottom: calc(18px + env(safe-area-inset-bottom)); }
  #palanca-punta { left: 34px; top: 34px; width: 48px; height: 48px; }
  .botones-tactiles { bottom: calc(10px + env(safe-area-inset-bottom)); width: 220px; height: 210px; }
  .prologo-texto { font-size: 20px; }
  .controles { font-size: 13px; }
}
/* teléfono en vertical («Jugar así»): la misión debajo del minimapa, sin pisar el estado */
@media (max-width: 600px) {
  .mision { top: calc(140px + env(safe-area-inset-top)); max-width: 62vw; }
  .botones-tactiles { width: 200px; }
}
.bt .tecla { position: absolute; left: 50%; top: 1px; transform: translateX(-50%); font: bold 11px/1 sans-serif; opacity: 0.9; pointer-events: none; }
.tarjeta, .llamados { touch-action: pan-y; }
/* que el «✕» de salir no tape el título de las tarjetas */
@media (max-height: 500px) { html.mj-movil .pantalla { padding-left: calc(52px + env(safe-area-inset-left)); } }
@media (max-width: 600px) { html.mj-movil .pantalla { padding-top: calc(52px + env(safe-area-inset-top)); } }
/* pausa en pantalla baja: «Seguir» y «Guardar y volver» arriba, sin tener que desplazarse */
@media (max-height: 500px) {
  #pausa .tarjeta { display: flex; flex-direction: column; }
  #pausa .tarjeta h2 { order: -3; }
  #pausa .botones-pausa { order: -2; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  #pausa .botones-pausa .boton { margin: 0; }
  .controles kbd { font-size: 13px; }
}
html.mj-movil #titulo-seguir small { font-size: 13px !important; }
/* vertical: la pausa debajo del nivel, sin tapar las barras */
@media (max-width: 600px) {
  .boton-pausa { left: calc(12px + env(safe-area-inset-left)); top: calc(82px + env(safe-area-inset-top)); transform: none; }
  html.mj-movil .boton-pausa { left: calc(56px + env(safe-area-inset-left)); }
}
/* computadora: el botón «Salir a Verbo» (modo-juego.js) va arriba a la izquierda; el estado queda debajo */
body:has(.mj-salir) .estado { top: calc(50px + env(safe-area-inset-top)); }
html.mj-movil body:has(.mj-salir) .estado { top: calc(12px + env(safe-area-inset-top)); }
@media (max-width: 600px) { .barras { width: min(230px, 33vw); } }

/* veneno (la serpiente de bronce): la barra de vida se pone verde */
#hud-vida.veneno { background: linear-gradient(#9ad45e, #3f7a26); animation: latido-veneno 1.2s ease-in-out infinite; }
@keyframes latido-veneno { 50% { filter: brightness(1.35); } }
/* «mirar»: un anillo en el centro que se llena mientras la cámara mira algo (misiones/base.js: actualizarMirar) */
#mirar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; }
#mirar .anillo { --f: 0; width: 64px; height: 64px; border-radius: 50%; opacity: 0.55;
  background: conic-gradient(#f6d488 calc(var(--f) * 360deg), rgba(255, 255, 255, 0.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px); mask: radial-gradient(circle, transparent 23px, #000 24px); }
#mirar.centrado .anillo { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 220, 140, 0.8)); }
#mirar span { font-size: 14px; background: var(--panel); border: 1px solid var(--borde); border-radius: 8px; padding: 4px 10px;
  text-shadow: 0 1px 2px #000; white-space: nowrap; }
@media (max-height: 500px) { #mirar .anillo { width: 52px; height: 52px; } #mirar span { font-size: 12px; } }
