.tk-fondo { position: fixed; inset: 0; z-index: 55; background: rgba(4, 7, 8, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tk-dialogo {
  width: min(340px, 100%); background: var(--p-tarjeta); border: 1px solid var(--p-borde); border-radius: var(--radio);
  color: var(--p-tinta); padding: 18px 18px 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.tk-titulo { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: var(--p-suave); letter-spacing: 0.02em; }
.tk-form { display: grid; gap: 14px; }
.tk-casilleros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tk-casillero { display: grid; gap: 6px; justify-items: center; }
.tk-sellos { font-size: 12px; color: var(--p-acento); letter-spacing: -0.05em; white-space: nowrap; min-height: 16px; }
.tk-digito {
  width: 100%; max-width: 62px; height: 56px; text-align: center; font: 600 24px var(--f-mono); color: var(--p-tinta);
  background: var(--p-fondo); border: 1px solid var(--p-borde); border-radius: 10px; padding: 0;
}
.tk-digito:focus { outline: none; border-color: var(--p-acento); box-shadow: 0 0 0 3px var(--p-acento-fondo); }
.tk-abrir { width: 100%; min-height: 46px; font-size: 15px; }
.tk-mensaje { min-height: 18px; margin: 10px 0 0; font-size: 13px; color: var(--p-peligro); }
/* En el celular el teclado del sistema tapa la mitad de abajo: el dialogo va arriba para que "Abrir" quede a la vista. */
@media (max-width: 600px) { .tk-fondo { align-items: flex-start; padding-top: 24px; } }
body[data-mundo="otro"] .tk-dialogo { background: #1a0a07; border-color: #4a1d14; color: #ead2c9; }

#pantalla-huida { background: #000; }
.hu { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hu-cam { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.hu-oxido, .hu-velo { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
/* El oxido trepa desde los bordes: la capa tiene el centro vacio y se achica hacia la pantalla a medida que se acerca. */
.hu-oxido {
  background-image: var(--oxido-rejilla), var(--oxido-rejilla-cruzada), var(--oxido-textura);
  background-color: rgba(70, 22, 10, 0.55);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 42%, #000 78%);
  mask-image: radial-gradient(ellipse at center, transparent 42%, #000 78%);
  transform: scale(1.55); will-change: transform, opacity;
}
.hu-velo { background: #000; }

.hu-perilla {
  position: absolute; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 236, 196, 0.95); background: radial-gradient(circle, rgba(255, 236, 190, 0.35) 0 30%, rgba(255, 236, 190, 0) 70%);
  box-shadow: 0 0 18px 4px rgba(255, 226, 170, 0.55); cursor: pointer; touch-action: none;
  animation: hu-perilla 1.4s ease-in-out infinite;
}
@keyframes hu-perilla { 50% { box-shadow: 0 0 26px 8px rgba(255, 226, 170, 0.75); } }

.hu-teclas {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); margin: 0; padding: 8px 14px; list-style: none;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; max-width: calc(100% - 32px);
  font: 500 12px var(--f-mono); color: rgba(226, 234, 230, 0.8); background: rgba(6, 8, 9, 0.55); border-radius: 6px;
  transition: opacity 1.2s;
}
.hu-teclas kbd { font: inherit; color: #fff; }
.hu-teclas.ido { opacity: 0; }

.hu-mandos { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
.hu-mandos-lado { display: flex; gap: 10px; pointer-events: auto; }
.hu-mandos-acciones { display: grid; grid-template-columns: 70px 70px; grid-template-rows: 54px 54px; gap: 8px; }
.hu-boton {
  width: 62px; height: 62px; border-radius: 14px; border: 1px solid rgba(220, 230, 226, 0.35); background: rgba(10, 13, 14, 0.5);
  color: rgba(236, 242, 239, 0.92); font: 600 13px var(--f-ui); padding: 0; touch-action: none; user-select: none; -webkit-user-select: none;
}
.hu-mandos-acciones .hu-boton { width: 100%; height: 100%; }
.hu-izq, .hu-der { font-size: 22px; }
.hu-boton.apretado { background: rgba(92, 196, 165, 0.35); border-color: rgba(92, 196, 165, 0.8); }

.hu-maria { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hu-maria-voz {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 6px 12px;
  border-radius: 6px; background: rgba(8, 11, 12, 0.72); pointer-events: none; text-align: center;
  font-family: var(--f-mono); font-size: 18px; line-height: 1.35; color: #a8e6df;
  text-shadow: 1px 0 rgba(255, 70, 70, 0.55), -1px 0 rgba(70, 200, 255, 0.55); transition: opacity 0.9s ease;
}
.hu-maria-voz.se-va { opacity: 0; }
.hu-mano {
  position: absolute; left: 0; top: 0; width: 72px; height: 72px; margin: -36px 0 0 -36px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 222, 186, 0.95); background: radial-gradient(circle, rgba(255, 214, 168, 0.22) 0 35%, rgba(255, 214, 168, 0) 70%);
  box-shadow: 0 0 16px 3px rgba(255, 206, 160, 0.5); cursor: pointer; touch-action: none;
  animation: hu-mano 1.1s ease-in-out infinite;
}
@keyframes hu-mano { 50% { box-shadow: 0 0 24px 7px rgba(255, 206, 160, 0.7); } }
.hu-mano-tecla {
  position: absolute; right: -10px; bottom: -6px; min-width: 18px; padding: 1px 4px; border-radius: 4px;
  font: 600 11px var(--f-mono); color: #2a1a12; background: rgba(255, 228, 196, 0.92);
}
.hu-mandos-acciones { grid-template-rows: auto 54px 54px; }
.hu-mandos-acciones .hu-agarrar { grid-column: 1 / 3; grid-row: 1; height: 64px; font-size: 16px; background: rgba(120, 70, 50, 0.6); border-color: rgba(255, 214, 176, 0.85); }
.hu-mandos-acciones .hu-correr { grid-column: 1; grid-row: 2 / 4; }
.hu-mandos-acciones .hu-saltar { grid-column: 2; grid-row: 2; }
.hu-mandos-acciones .hu-agachar { grid-column: 2; grid-row: 3; }
@media (prefers-reduced-motion: reduce) {
  .hu-mano { animation: none; }
  .hu-maria-voz { transition: none; }
}
