/* ==========================================================================
   CÁLCULO EXTREMO — ESTILO NOWEY
   ========================================================================= */

.mate-container {
  max-width: 480px;
  width: calc(100% - 24px);
  margin: 0 auto 30px auto;
}

.mate-viewport {
  position: relative;
}

.mate-viewport:fullscreen {
  background: #04080c;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
}
.mate-viewport:-webkit-full-screen {
  background: #04080c;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
}

.mate-viewport:fullscreen .mate-board,
.mate-viewport:-webkit-full-screen .mate-board {
  height: 82vh;
  max-height: none;
}

.btn-fullscreen-mate {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 25;
  background: rgba(4, 8, 12, 0.7);
  border: 1px solid rgba(0, 183, 255, 0.35);
  color: #00b7ff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-fullscreen-mate:hover {
  background: rgba(0, 183, 255, 0.15);
}

.btn-pausa-mate {
  position: absolute;
  top: 8px;
  right: 50px;
  z-index: 25;
  background: rgba(4, 8, 12, 0.7);
  border: 1px solid rgba(0, 183, 255, 0.35);
  color: #00b7ff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-pausa-mate:hover {
  background: rgba(0, 183, 255, 0.15);
}

.overlay-pausa {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.92);
  z-index: 22;
}
.overlay-pausa h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: #00b7ff;
  text-shadow: 0 0 10px rgba(0, 183, 255, 0.6);
  margin-bottom: 16px;
}

.aviso-nivel {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 21;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: #ff7b00;
  text-shadow: 0 0 16px rgba(255, 123, 0, 0.8);
  letter-spacing: 2px;
  pointer-events: none;
  animation: aviso-nivel-anim 1.4s ease forwards;
}
@keyframes aviso-nivel-anim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ==========================================================================
   HUD
   ========================================================================= */
.mate-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 21, 32, 0.85);
  border: 1px solid rgba(0, 183, 255, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-family: 'Chakra Petch', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.hud-vidas .corazon {
  font-size: 1.1rem;
  color: #ff2b5e;
  text-shadow: 0 0 8px rgba(255, 43, 94, 0.7);
  margin-right: 2px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hud-vidas .corazon.perdido {
  opacity: 0.15;
  text-shadow: none;
  transform: scale(0.8);
}

.hud-puntaje {
  color: #39ff14;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.5);
}

.hud-nivel {
  color: #ff7b00;
  text-shadow: 0 0 6px rgba(255, 123, 0, 0.5);
}

.hud-combo {
  color: #ffe94d;
  text-shadow: 0 0 8px rgba(255, 233, 77, 0.7);
  font-size: 0.95rem;
  transition: transform 0.15s ease;
}

.hud-combo.combo-pulso {
  animation: combo-pop 0.25s ease;
}

@keyframes combo-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   RÉCORD
   ========================================================================= */
.record-chip {
  font-family: 'Chakra Petch', monospace;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: #94a3b8;
  border: 1px solid rgba(0, 183, 255, 0.25);
  border-radius: 20px;
  padding: 6px 16px;
  margin-bottom: 14px;
  background: rgba(0, 183, 255, 0.06);
}

.record-chip span {
  color: #00b7ff;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(0, 183, 255, 0.5);
}

.record-nuevo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  color: #ffe94d;
  text-shadow: 0 0 10px rgba(255, 233, 77, 0.7);
  font-size: 0.9rem;
  margin: -6px 0 14px 0 !important;
  animation: record-brillo 0.9s ease-in-out infinite;
}

@keyframes record-brillo {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ==========================================================================
   TABLERO DE CAÍDA
   ========================================================================= */
.mate-board {
  position: relative;
  height: 68vh;
  min-height: 420px;
  max-height: 620px;
  background: #04080c;
  border: 1px solid rgba(0, 183, 255, 0.15);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.linea-piso {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 46px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 43, 94, 0.6), transparent);
  box-shadow: 0 0 10px rgba(255, 43, 94, 0.4);
}

/* ==========================================================================
   EJERCICIOS QUE CAEN
   ========================================================================= */
.ejercicio-caida {
  position: absolute;
  top: -70px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border-radius: 10px;
  font-family: 'Orbitron', 'Chakra Petch', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0 6px;
  text-align: center;
  line-height: 1.15;
}

.ejercicio-caida:active {
  transform: scale(0.95);
}

.ejercicio-caida.pausado {
  outline: 2px solid #fff;
  animation: pulso-pausado 0.9s ease-in-out infinite;
}

@keyframes pulso-pausado {
  0%, 100% { box-shadow: 0 0 6px rgba(255,255,255,0.3); }
  50% { box-shadow: 0 0 18px rgba(255,255,255,0.8); }
}

.ejercicio-caida.nivel-0 {
  background: rgba(0, 183, 255, 0.18);
  border-color: rgba(0, 183, 255, 0.6);
  box-shadow: 0 0 10px rgba(0, 183, 255, 0.3);
}
.ejercicio-caida.nivel-1 {
  background: rgba(57, 255, 20, 0.15);
  border-color: rgba(57, 255, 20, 0.6);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}
.ejercicio-caida.nivel-2 {
  background: rgba(255, 123, 0, 0.15);
  border-color: rgba(255, 123, 0, 0.6);
  box-shadow: 0 0 10px rgba(255, 123, 0, 0.3);
}
.ejercicio-caida.nivel-3 {
  background: rgba(255, 43, 94, 0.18);
  border-color: rgba(255, 43, 94, 0.65);
  box-shadow: 0 0 12px rgba(255, 43, 94, 0.4);
}

.ejercicio-caida.acertado {
  animation: destello-ok 0.35s ease forwards;
}
@keyframes destello-ok {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.ejercicio-caida.fallado {
  animation: shake-fallo 0.35s ease;
}
@keyframes shake-fallo {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================================================
   PARTÍCULAS Y SACUDIDA DE PANTALLA
   ========================================================================= */
.mate-board.sacudida {
  animation: sacudida-tablero 0.3s ease;
}
@keyframes sacudida-tablero {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.particula {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  animation: particula-vuelo 0.55s ease-out forwards;
}

@keyframes particula-vuelo {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--px), var(--py)) scale(0); opacity: 0; }
}

.puntos-flotantes {
  position: absolute;
  z-index: 16;
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  color: #39ff14;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
  pointer-events: none;
  animation: puntos-subir 0.7s ease-out forwards;
}

@keyframes puntos-subir {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-40px); opacity: 0; }
}

/* ==========================================================================
   OVERLAYS (Inicio / Fin de partida)
   ========================================================================= */
.overlay-inicio,
.overlay-fin {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(4, 8, 12, 0.92);
  z-index: 20;
  padding: 20px;
  box-sizing: border-box;
}

.overlay-inicio h2,
.overlay-fin h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  margin: 0 0 10px 0;
  background: linear-gradient(90deg, #00b7ff, #39ff14, #ff7b00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay-inicio p,
.overlay-fin p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0 0 20px 0;
  max-width: 300px;
}

.oculto {
  display: none !important;
}

/* ==========================================================================
   BOTONES
   ========================================================================= */
.btn-mate {
  display: inline-block;
  background: transparent;
  border: 1px solid #ff7b00;
  color: #ff7b00;
  padding: 12px 26px;
  border-radius: 8px;
  font-family: 'Chakra Petch', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 6px;
  transition: all 0.2s ease;
}
.btn-mate:hover {
  background: rgba(255, 123, 0, 0.12);
}

.btn-jugar {
  border-color: #39ff14;
  color: #39ff14;
  font-size: 1rem;
  padding: 14px 34px;
}
.btn-jugar:hover {
  background: rgba(57, 255, 20, 0.12);
}

.btn-salir {
  border-color: #64748b;
  color: #94a3b8;
}

/* ==========================================================================
   TECLADO NUMÉRICO (modal)
   ========================================================================= */
.teclado-overlay {
  position: fixed;
  inset: 0;
  background: #02050a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.teclado-caja {
  width: 100%;
  max-width: 280px;
  background: #0a1520;
  border: 1px solid rgba(0, 183, 255, 0.3);
  border-radius: 14px;
  padding: 14px 14px 18px 14px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
}

.teclado-pregunta {
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.teclado-pantalla {
  text-align: center;
  font-family: 'Chakra Petch', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  min-height: 32px;
  background: #04080c;
  border: 1px solid rgba(0, 183, 255, 0.25);
  border-radius: 8px;
  color: #39ff14;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.teclado-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.tecla {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #e2e8f0;
  background: #101c28;
  border: 1px solid rgba(0, 183, 255, 0.2);
  border-radius: 8px;
  padding: 11px 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.tecla:active {
  transform: scale(0.93);
  background: rgba(0, 183, 255, 0.2);
}

.tecla-signo {
  color: #ff7b00;
}

.tecla-borrar {
  color: #ff2b5e;
}

.teclado-acciones {
  display: flex;
  gap: 8px;
}
.teclado-acciones .btn-mate {
  padding: 9px 10px;
  font-size: 0.72rem;
}
.teclado-acciones .btn-mate {
  flex: 1;
  margin: 0;
  text-align: center;
}

.btn-confirmar {
  border-color: #39ff14;
  color: #39ff14;
}
.btn-confirmar:hover {
  background: rgba(57, 255, 20, 0.12);
}

.btn-cancelar {
  border-color: #ff2b5e;
  color: #ff2b5e;
}
.btn-cancelar:hover {
  background: rgba(255, 43, 94, 0.12);
}
