/* VR Studio — Mini-jeux (2026-10-10) : vrgame/js/game-minigames.js
 * Grosses cibles (≥ 56 px) pour le doigt ou la souris, focus très visible pour le clavier d'une main.
 */
.mg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000003;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.75), rgba(2, 6, 23, 0.92) 70%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 200ms ease;
  font-family: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #f8fafc;
}
.mg-overlay.is-open { opacity: 1; }
.mg-overlay.is-closing { opacity: 0; }
.mg-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(560px, 100%);
  max-height: 100%;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 22px;
  background: rgba(9, 12, 22, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(10px) scale(0.98);
  transition: transform 220ms cubic-bezier(.2, .9, .3, 1.2), border-color 300ms ease, box-shadow 300ms ease;
}
.mg-overlay.is-open .mg-card { transform: none; }
.mg-card.is-won { border-color: #22c55e; box-shadow: 0 0 60px rgba(34, 197, 94, 0.45); }
.mg-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mg-icon { font-size: 34px; line-height: 1; }
.mg-titles { flex: 1 1 auto; min-width: 0; }
.mg-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f59e0b;
}
.mg-title { margin: 2px 0 0; font-size: 24px; font-weight: 900; }
.mg-quit {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.mg-intro, .mg-hint {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.85);
}
.mg-hint { padding: 8px 12px; border-radius: 10px; background: rgba(245, 158, 11, 0.12); color: #fde68a; }
.mg-board { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.mg-status {
  min-height: 1.4em;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: rgba(226, 232, 240, 0.8);
}
.mg-status.is-ok { color: #86efac; }
.mg-status.is-bad { color: #fca5a5; }
.mg-status.is-warn { color: #fde68a; }

/* Boutons communs : focus clavier très visible */
.mg-board button { font: inherit; cursor: pointer; }
.mg-board button:focus-visible,
.mg-quit:focus-visible { outline: 3px solid #fde047; outline-offset: 3px; }

/* ── Code secret ── */
.mg-code-display { display: flex; gap: 10px; }
.mg-code-display.is-shake { animation: mg-shake 420ms ease; }
.mg-code-slot {
  display: grid;
  place-items: center;
  width: 46px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 30px;
  font-weight: 900;
}
.mg-code-slot.is-filled { border-color: #f59e0b; color: #fde68a; }
.mg-keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; }
.mg-key {
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}
.mg-key:hover { background: rgba(255, 255, 255, 0.14); }
.mg-key-ok { background: linear-gradient(135deg, #f59e0b, #f97316); color: #1c1003; border-color: transparent; }
.mg-key-del { color: #fca5a5; }
@keyframes mg-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

/* ── Quiz ── */
.mg-quiz-progress { font-size: 13px; font-weight: 800; color: #f59e0b; letter-spacing: 0.1em; text-transform: uppercase; }
.mg-quiz-q { margin: 0; font-size: 20px; font-weight: 800; text-align: center; line-height: 1.35; }
.mg-quiz-answers { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.mg-answer {
  min-height: 56px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
}
.mg-answer:hover:not([disabled]) { background: rgba(255, 255, 255, 0.12); }
.mg-answer.is-good { border-color: #22c55e; background: rgba(34, 197, 94, 0.25); }
.mg-answer.is-bad { border-color: #ef4444; background: rgba(239, 68, 68, 0.25); }

/* ── Memory ── */
.mg-memory { display: grid; gap: 10px; }
.mg-memory.mg-cols-3 { grid-template-columns: repeat(3, 82px); }
.mg-memory.mg-cols-4 { grid-template-columns: repeat(4, 82px); }
.mg-tile {
  position: relative;
  height: 82px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: linear-gradient(135deg, #1e293b, #312e81);
  font-size: 38px;
  transition: transform 200ms ease, background 200ms ease;
}
.mg-tile-face { opacity: 0; transition: opacity 160ms ease; }
.mg-tile.is-open,
.mg-tile.is-found { background: rgba(255, 255, 255, 0.1); transform: rotateY(180deg) scaleX(-1); }
.mg-tile.is-open .mg-tile-face,
.mg-tile.is-found .mg-tile-face { opacity: 1; }
.mg-tile.is-found { border-color: #22c55e; cursor: default; }

/* ── Séquence ── */
.mg-seq { display: grid; grid-template-columns: repeat(2, 120px); gap: 14px; }
.mg-pad {
  height: 110px;
  border: 3px solid rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  opacity: 0.55;
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.mg-pad-red { background: #ef4444; }
.mg-pad-blue { background: #3b82f6; }
.mg-pad-green { background: #22c55e; }
.mg-pad-yellow { background: #facc15; }
.mg-pad.is-lit { opacity: 1; transform: scale(1.05); box-shadow: 0 0 34px rgba(255, 255, 255, 0.6); }
.mg-seq-step { font-size: 15px; font-weight: 800; color: rgba(226, 232, 240, 0.85); }

/* ── Réflexe ── */
.mg-reflex-track {
  position: relative;
  width: 100%;
  height: 54px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}
.mg-reflex-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20%;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.55), rgba(22, 163, 74, 0.45));
  transition: left 200ms ease;
}
.mg-zone-0 { left: 10%; }
.mg-zone-1 { left: 25%; }
.mg-zone-2 { left: 40%; }
.mg-zone-3 { left: 55%; }
.mg-zone-4 { left: 70%; }
.mg-reflex-cursor {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 10px;
  border-radius: 6px;
  background: #fde047;
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.8);
  animation-name: mg-sweep;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}
.mg-speed-slow { animation-duration: 2.4s; }
.mg-speed-normal { animation-duration: 1.7s; }
.mg-speed-fast { animation-duration: 1.15s; }
.mg-reflex-cursor.is-stopped { animation-play-state: paused; }
@keyframes mg-sweep {
  from { left: 0; }
  to { left: calc(100% - 10px); }
}
.mg-reflex-btn {
  width: 100%;
  min-height: 68px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #1c1003;
  font-size: 22px;
  font-weight: 900;
}

/* ── Petits écrans ── */
@media (max-width: 520px), (max-height: 480px) {
  .mg-card { padding: 14px; gap: 8px; }
  .mg-title { font-size: 20px; }
  .mg-keypad { grid-template-columns: repeat(3, 64px); gap: 8px; }
  .mg-key { height: 52px; font-size: 22px; }
  .mg-memory.mg-cols-4 { grid-template-columns: repeat(4, 64px); }
  .mg-memory.mg-cols-3 { grid-template-columns: repeat(3, 64px); }
  .mg-tile { height: 64px; font-size: 30px; }
  .mg-seq { grid-template-columns: repeat(2, 96px); }
  .mg-pad { height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .mg-speed-slow, .mg-speed-normal, .mg-speed-fast { animation-duration: 3.2s; }
}
