/* Estilos del juego (demo web) - pantalla de telefono en horizontal */

:root {
  --cyan: #00a0e3;
  --magenta: #e6007e;
  --amarillo: #f5d000;
  --negro: #1f2430;
  --blanco: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #9fdcff;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--negro);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.oculto {
  display: none !important;
}

/* Area de juego */
#juego {
  position: fixed;
  inset: 0;
}

#escena {
  display: block;
  width: 100%;
  height: 100%;
}

/* Marcador superior */
#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.hud-pastilla {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid var(--negro);
  border-radius: 22px;
  font-size: 20px;
  font-weight: 800;
}

.hud-derecha {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-boton {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid var(--negro);
  border-radius: 22px;
  pointer-events: auto;
  cursor: pointer;
}

.hud-boton .tache {
  display: none;
}

.hud-boton.apagado .tache {
  display: inline;
}

.hud-boton.apagado .ondas {
  display: none;
}

.hud-moneda {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--amarillo);
  border: 3px solid var(--negro);
}

/* Mensajes de la historia */
/* Cintillo "Sabias que": linea que corre arriba, sin cuadro */
#cintillo {
  position: absolute;
  top: 12px;
  left: 120px;
  right: 190px;
  height: 44px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#cintillo.visible {
  opacity: 1;
}

#cintilloTexto {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -10px;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
  color: #ffffff;
  text-shadow: -1px -1px 0 #1f2430, 1px -1px 0 #1f2430, -1px 1px 0 #1f2430, 1px 1px 0 #1f2430, 0 2px 3px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

#cintilloTexto b {
  color: #f5d000;
}

#aviso {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 18px;
  background: rgba(31, 36, 48, 0.85);
  color: var(--blanco);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#aviso.visible {
  opacity: 1;
}

/* Joystick */
#joyBase {
  position: absolute;
  left: 40px;
  bottom: 36px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 3px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

#joyBase.activo {
  background: rgba(255, 255, 255, 0.35);
}

#joyKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid var(--negro);
  transform: translate(-50%, -50%);
}

/* Boton de salto */
#btnSalto {
  position: absolute;
  right: 40px;
  bottom: 44px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

#btnSalto.presionado {
  background: rgba(255, 255, 255, 0.75);
}

/* Destello al caer */
#flash {
  position: absolute;
  inset: 0;
  background: var(--magenta);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

#flash.visible {
  opacity: 0.45;
  transition: none;
}

/* Capas de inicio, final y girar */
.capa {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(31, 36, 48, 0.55);
}

.tarjeta {
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow: hidden;
  padding: 16px 20px;
  background: var(--blanco);
  border: 4px solid var(--negro);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--negro);
  text-align: center;
}

.tarjeta-logo {
  display: block;
  max-width: 140px;
  max-height: 64px;
  margin: 0 auto 6px;
}

.tarjeta h1 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.tarjeta p {
  font-size: 14px;
  margin-bottom: 8px;
}

.mensaje-estado {
  text-align: center;
  font-size: 16px !important;
  line-height: 1.5;
}

.tarjeta-nota {
  font-size: 12px !important;
  color: #5a6070;
}

.tarjeta-slogan {
  font-weight: 700;
  color: var(--magenta);
}

.boton {
  display: inline-block;
  min-width: 180px;
  height: 52px;
  padding: 0 24px;
  background: var(--magenta);
  color: var(--blanco);
  border: 3px solid var(--negro);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--negro);
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.boton:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--negro);
}

.colores {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.color-op {
  width: 44px;
  height: 44px;
  border: 3px solid var(--negro);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.color-op:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.color-op.elegido {
  box-shadow: 0 0 0 3px var(--blanco), 0 0 0 6px var(--magenta);
}

.modo-botones {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.modo-botones .boton {
  min-width: 160px;
}

.boton-cyan {
  background: var(--cyan);
}

.final-botones {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.boton-chico {
  min-width: 0;
  padding: 0 20px;
  line-height: 46px;
  background: var(--blanco);
  color: var(--negro);
  text-decoration: none;
}

#errorBox,
#salaOcupada,
#colorOcupado {
  margin-top: 10px;
  font-size: 14px;
  color: #c62828;
}

.final-datos {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 10px;
}

.final-dato {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  padding: 6px 10px;
  background: #fff7cc;
  border: 3px solid var(--negro);
  border-radius: 12px;
}

.final-etiqueta {
  font-size: 12px;
  font-weight: 700;
}

.final-valor {
  font-size: 22px;
  font-weight: 800;
}

/* Aviso para girar el telefono */
#girar {
  display: none;
  background: var(--negro);
  color: var(--blanco);
  z-index: 50;
}

#girar p {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 700;
}

.girar-telefono {
  width: 56px;
  height: 92px;
  border: 5px solid var(--blanco);
  border-radius: 10px;
  animation: girar 1.6s ease-in-out infinite;
}

@keyframes girar {
  0%, 20% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

@media (orientation: portrait) {
  #girar {
    display: flex;
  }
}
