/* ==========================================================================
   MINIJUEGOS Y ANIMACIONES DEL SIMULADOR
   Acompaña el tema "oscuro pulido" del simulador (simulador-tv.css):
   negro profundo, Inter, acciones en blanco y el naranja de marca como acento.
   ========================================================================== */

/* ---------- Opción de minijuego en la tarjeta de decisión ---------- */
.option-btn.option-btn--minijuego {
  box-shadow: inset 0 0 0 1px rgba(255, 138, 31, 0.55) !important;
  background: linear-gradient(135deg, rgba(255, 138, 31, 0.12), rgba(255, 255, 255, 0.04)) !important;
}
.option-btn.option-btn--minijuego:hover {
  box-shadow: inset 0 0 0 1px #ff8a1f, 0 30px 60px -18px rgba(0, 0, 0, 0.95) !important;
}
.risk-tag.minijuego-tag {
  background: #ff8a1f !important;
  color: #111 !important;
  border: 0 !important;
  font-weight: 700;
}

/* ---------- Overlay del minijuego ---------- */
body.mj-open { overflow: hidden; }

.mj-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: clamp(0.5rem, 2vw, 1.5rem);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: mj-in 0.25s ease both;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: #f5f5f7;
}
.mj-overlay.is-leaving { animation: mj-out 0.18s ease both; }
@keyframes mj-in { from { opacity: 0; } }
@keyframes mj-out { to { opacity: 0; } }

.mj-card {
  width: min(880px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #111113;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
  animation: mj-card-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes mj-card-in { from { transform: translateY(14px) scale(0.98); opacity: 0; } }

.mj-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem 0.9rem;
}
.mj-kicker {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff8a1f;
}
.mj-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.mj-head-text { min-width: 0; }
.mj-head-side { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.mj-hud {
  font-size: 0.85rem;
  font-weight: 600;
  color: #a1a1a6;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* Salir en medio del juego (en el celular no hay tecla Escape) */
.mj-quit {
  min-height: 36px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
  font: 600 0.82rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
.mj-quit:hover { background: rgba(255, 255, 255, 0.2); }
.mj-quit[hidden] { display: none; }

.mj-progress { height: 3px; background: rgba(255, 255, 255, 0.08); }
.mj-progress span { display: block; height: 100%; width: 0; background: #ff8a1f; transition: width 0.2s linear; }

.mj-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: calc(100vh - 9rem);
  max-height: calc(100dvh - 9rem);
  background: #0b0b0c;
}
.mj-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* Pantallas sobre el canvas: instrucciones y resultado */
.mj-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  justify-content: safe center;
  gap: 0.75rem;
  padding: clamp(1rem, 4vw, 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
  background: rgba(11, 11, 12, 0.9);
}
.mj-screen[hidden] { display: none; }
.mj-instr { max-width: 34rem; margin: 0; font-size: clamp(0.95rem, 1.6vw, 1.08rem); line-height: 1.5; color: #e5e5ea; }
.mj-controls {
  margin: 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 600;
  color: #f5f5f7;
}
.mj-goal { margin: 0; font-size: 0.85rem; color: #a1a1a6; }
.mj-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 0.5rem; }

.mj-btn {
  min-height: 46px;
  padding: 0 1.3rem;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
  font: 600 0.95rem Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease;
}
.mj-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.03); }
.mj-btn--primary { background: #f5f5f7; color: #000; }
.mj-btn--primary:hover { background: #fff; }
.mj-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.mj-result-label { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.mj-screen--result.is-win .mj-result-label { color: #34d399; }
.mj-screen--result.is-lose .mj-result-label { color: #ff5a4e; }
.mj-result-score {
  margin: 0;
  font-size: clamp(4rem, 12vw, 6.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  animation: mj-pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.4) both;
}
.mj-result-score small { font-size: 0.4em; color: #a1a1a6; margin-left: 0.1em; }
.mj-result-detail { margin: 0; color: #a1a1a6; }
@keyframes mj-pop { from { transform: scale(0.6); opacity: 0; } }

/* Celular (vertical u horizontal): el minijuego ocupa toda la pantalla */
@media (max-width: 640px), (max-height: 520px) {
  .mj-overlay { padding: 0; place-items: stretch; backdrop-filter: none; -webkit-backdrop-filter: none; background: #0b0b0c; }
  .mj-card {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
    background: #0b0b0c;
  }
  .mj-head {
    align-items: center;
    gap: 0.75rem;
    padding: calc(0.55rem + env(safe-area-inset-top)) calc(0.9rem + env(safe-area-inset-right)) 0.55rem calc(0.9rem + env(safe-area-inset-left));
  }
  .mj-kicker { margin-bottom: 0.15rem; font-size: 0.66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mj-title { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mj-hud { font-size: 0.78rem; max-width: 9rem; }
  .mj-stage { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; max-height: none; }
  .mj-instr { font-size: 1rem; }
  .mj-controls { font-size: 0.9rem; line-height: 1.4; border-radius: 14px; padding: 0.55rem 0.9rem; }
  .mj-actions { width: 100%; max-width: 22rem; flex-direction: column; }
  .mj-btn { width: 100%; min-height: 52px; font-size: 1rem; }
}
@media (max-height: 520px) {
  .mj-kicker { display: none; }
}

/* ==========================================================================
   ANIMACIONES DE SUCESOS (js/animaciones.js)
   ========================================================================== */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 4500;
}

.fx-shake { animation: fx-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes fx-shake {
  15%, 85% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(5px); }
  45%, 55% { transform: translateX(-7px); }
}

.fx-pulse { animation: fx-pulse 0.65s ease both; }
@keyframes fx-pulse {
  30% { transform: scale(1.14); filter: brightness(1.25); }
}

.fx-float {
  position: fixed;
  z-index: 4600;
  transform: translate(-50%, 0);
  pointer-events: none;
  font: 800 1rem Inter, system-ui, sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
  animation: fx-float 1.25s ease-out both;
}
.fx-float.is-up { color: #34d399; }
.fx-float.is-down { color: #ff5a4e; }
@keyframes fx-float {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -44px); }
}

/* Cartel de inicio de temporada */
.fx-banner {
  position: fixed;
  inset: 0;
  z-index: 4700;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  animation: fx-fade 0.3s ease both;
}
.fx-banner.is-leaving { animation: fx-fade-out 0.35s ease both; }
.fx-banner-inner { text-align: center; animation: fx-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.fx-banner-kicker {
  margin: 0 0 0.5rem;
  font: 700 0.8rem Inter, system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff8a1f;
}
.fx-banner-title {
  margin: 0;
  font: 800 clamp(3.5rem, 12vw, 7rem) Inter, system-ui, sans-serif;
  letter-spacing: -0.05em;
  line-height: 1;
  color: #fff;
}
@keyframes fx-fade { from { opacity: 0; } }
@keyframes fx-fade-out { to { opacity: 0; } }
@keyframes fx-rise { from { opacity: 0; transform: translateY(18px) scale(0.96); } }

@media (prefers-reduced-motion: reduce) {
  .mj-overlay, .mj-card, .mj-result-score, .fx-banner, .fx-banner-inner, .fx-float { animation: none !important; }
}
