/* ==========================================================================
   Marché X3 — Module Mini-Jeux Promotionnels (Gamification E-commerce)
   Glassmorphism Modal • Charte Marché X3 (#C8161D, #168039, #FACC15) • 60 FPS
   ========================================================================== */

/* Floating Gift Launcher Button */
.mx3g-launcher {
  position: fixed;
  bottom: 22px;
  inset-inline-end: 22px;
  z-index: 960;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 2px solid #FACC15;
  background: linear-gradient(135deg, #C8161D 0%, #9E0E14 100%);
  color: #FFFFFF;
  font-family: 'Cairo', 'Roboto', sans-serif;
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(200, 22, 29, 0.38);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: mx3gLauncherPulse 3.2s ease-in-out infinite;
}

.mx3g-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 32px rgba(200, 22, 29, 0.48);
}

.mx3g-launcher-gift {
  font-size: 1.25rem;
  display: inline-block;
  animation: mx3gWiggle 2.6s ease-in-out infinite;
}

@keyframes mx3gLauncherPulse {
  0%, 100% { box-shadow: 0 10px 26px rgba(200, 22, 29, 0.38), 0 0 0 0 rgba(250, 204, 21, 0.5); }
  50%      { box-shadow: 0 10px 26px rgba(200, 22, 29, 0.38), 0 0 0 10px rgba(250, 204, 21, 0); }
}

@keyframes mx3gWiggle {
  0%, 84%, 100% { transform: rotate(0deg); }
  88% { transform: rotate(-14deg); }
  92% { transform: rotate(14deg); }
  96% { transform: rotate(-8deg); }
}

/* Modal Overlay (Glassmorphism Backdrop) */
.mx3g-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(11, 35, 20, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mx3g-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal Card */
.mx3g-modal {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.97) 0%, rgba(244, 249, 246, 0.96) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 28px 65px rgba(8, 30, 16, 0.42);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  color: #1C241E;
}

.mx3g-overlay.is-open .mx3g-modal {
  transform: translateY(0) scale(1);
}

.mx3g-confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Modal Header */
.mx3g-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  background: linear-gradient(120deg, #0B5222 0%, #168039 58%, #0F662B 100%);
  color: #FFFFFF;
  border-bottom: 3px solid #FACC15;
}

.mx3g-brand-badge {
  display: inline-block;
  background: #FACC15;
  color: #1C241E;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.mx3g-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.2;
}

.mx3g-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mx3g-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease;
}

.mx3g-icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.06);
}

/* Game Switcher Tabs */
.mx3g-switcher {
  display: flex;
  gap: 6px;
  padding: 12px 18px 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.mx3g-switch-btn {
  border: 1.5px solid #DCE5DF;
  background: #FFFFFF;
  color: #435348;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mx3g-switch-btn:hover:not(:disabled) {
  border-color: #168039;
  color: #0F662B;
}

.mx3g-switch-btn.active {
  background: #C8161D;
  border-color: #C8161D;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(200, 22, 29, 0.28);
}

.mx3g-switch-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Body */
.mx3g-body {
  padding: 18px 22px 24px;
}

.mx3g-alert {
  background: #FEEBEC;
  border: 1px solid #F5C2C7;
  color: #A11016;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  text-align: center;
}

/* Buttons */
.mx3g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-family: 'Cairo', 'Roboto', sans-serif;
  font-weight: 900;
  font-size: 0.96rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.mx3g-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.mx3g-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mx3g-btn-lg { padding: 13px 28px; font-size: 1.02rem; }
.mx3g-btn-block { width: 100%; }

.mx3g-btn-red {
  background: linear-gradient(135deg, #D91820, #B51117);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(200, 22, 29, 0.32);
}

.mx3g-btn-green {
  background: linear-gradient(135deg, #168039, #0F662B);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(22, 128, 57, 0.28);
}

.mx3g-btn-yellow {
  background: linear-gradient(135deg, #FACC15, #EAB308);
  color: #1C241E;
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.38);
}

/* Step 1: Lead Capture */
.mx3g-lead-hero {
  text-align: center;
  margin-bottom: 18px;
}

.mx3g-lead-emoji {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 8px;
}

.mx3g-lead-hero h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 900;
  color: #0F662B;
}

.mx3g-lead-hero p {
  margin: 0;
  font-size: 0.9rem;
  color: #435348;
}

.mx3g-lead-form {
  display: grid;
  gap: 12px;
}

.mx3g-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid #DCE5DF;
  background: #FFFFFF;
  font-size: 0.98rem;
  font-weight: 700;
  color: #1C241E;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mx3g-input:focus {
  border-color: #168039;
  box-shadow: 0 0 0 4px rgba(22, 128, 57, 0.14);
}

.mx3g-footnote {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: #6C7D72;
}

/* ==========================================================================
   GAME 1: SPIN WHEEL
   ========================================================================== */
.mx3g-wheel-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
  margin-bottom: 16px;
}

.mx3g-wheel-halo {
  position: absolute;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.35) 0%, rgba(22, 128, 57, 0.14) 55%, transparent 72%);
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.mx3g-wheel-halo.is-active {
  animation: mx3gHaloGlow 0.9s ease-in-out infinite alternate;
}

@keyframes mx3gHaloGlow {
  from { transform: scale(1); opacity: 0.75; }
  to   { transform: scale(1.1); opacity: 1; }
}

.mx3g-wheel-pointer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: 50% 10px;
  z-index: 6;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.28));
  will-change: transform;
}

.mx3g-wheel-canvas {
  position: relative;
  z-index: 2;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 12px 24px rgba(11, 50, 24, 0.25));
}

.mx3g-wheel-center-btn {
  position: absolute;
  top: calc(50% + 9px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #FACC15;
  background: linear-gradient(135deg, #C8161D, #9E0E14);
  color: #FFFFFF;
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.mx3g-wheel-center-btn:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.08);
}

.mx3g-game-action {
  text-align: center;
}

/* ==========================================================================
   GAME 2: SCRATCH CARD
   ========================================================================== */
.mx3g-scratch-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 200px;
  margin: 6px auto 14px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15, 50, 25, 0.16);
  border: 3px solid #FACC15;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  background: linear-gradient(135deg, #FFFDF4 0%, #E9F7EE 100%);
}

.mx3g-scratch-under {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}

.mx3g-scratch-icon { font-size: 2.5rem; margin-bottom: 4px; }
.mx3g-scratch-label { font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 1.2rem; color: #0F662B; line-height: 1.2; }
.mx3g-scratch-code {
  margin-top: 8px;
  background: #C8161D;
  color: #FFFFFF;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 4px 16px;
  border-radius: 999px;
  font-size: 1rem;
}
.mx3g-scratch-sub { font-size: 0.84rem; color: #435348; margin-top: 4px; }

.mx3g-scratch-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: crosshair;
  touch-action: none;
}

.mx3g-scratch-sparkles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.mx3g-scratch-progress {
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}

.mx3g-scratch-bar {
  height: 7px;
  border-radius: 99px;
  background: #E2EAE4;
  overflow: hidden;
  margin-bottom: 6px;
}

.mx3g-scratch-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #168039, #FACC15, #C8161D);
  transition: width 0.14s ease;
}

.mx3g-scratch-progress small {
  font-size: 0.82rem;
  font-weight: 700;
  color: #435348;
}

/* ==========================================================================
   GAME 3: 3 MYSTERY CHESTS
   ========================================================================== */
.mx3g-chests-prompt {
  text-align: center;
  margin: 0 0 18px;
  font-size: 0.92rem;
  color: #435348;
}

.mx3g-chests-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 18px;
}

.mx3g-chest {
  position: relative;
  border: none;
  background: transparent;
  padding: 34px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.22s ease, opacity 0.4s ease;
}

.mx3g-chest:hover:not(.is-open) {
  animation: mx3gChestShake 0.45s ease-in-out infinite;
}

.mx3g-chest.is-shaking {
  animation: mx3gChestShake 0.22s ease-in-out infinite;
}

@keyframes mx3gChestShake {
  0%, 100% { transform: translateY(-4px) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(-4deg); }
  75% { transform: translateY(-6px) rotate(4deg); }
}

.mx3g-chest-beam {
  position: absolute;
  bottom: 44px;
  left: 50%;
  width: 110px;
  height: 145px;
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom center;
  background: radial-gradient(ellipse at bottom, rgba(250, 204, 21, 0.92) 0%, rgba(250, 204, 21, 0.35) 55%, transparent 78%);
  clip-path: polygon(28% 100%, 72% 100%, 100% 0%, 0% 0%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.mx3g-chest.is-open.is-winner .mx3g-chest-beam {
  transform: translateX(-50%) scaleY(1);
  opacity: 1;
}

.mx3g-chest-prize {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translate(-50%, 24px) scale(0.5);
  opacity: 0;
  z-index: 6;
  text-align: center;
  width: 116px;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.mx3g-chest.is-open .mx3g-chest-prize {
  transform: translate(-50%, -6px) scale(1);
  opacity: 1;
}

.mx3g-chest-prize-icon {
  display: block;
  font-size: 1.7rem;
  line-height: 1.1;
}

.mx3g-chest-prize-label {
  display: inline-block;
  margin-top: 2px;
  background: #FFFFFF;
  color: #1C241E;
  border: 1.5px solid #FACC15;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.mx3g-chest-box {
  position: relative;
  width: 84px;
  height: 70px;
  margin-top: 14px;
}

.mx3g-chest-lid {
  position: relative;
  z-index: 3;
  height: 24px;
  width: 90px;
  margin-left: -3px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #E11D25 0%, #B51117 100%);
  border: 2px solid #FACC15;
  transform-origin: center bottom;
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mx3g-chest.is-open .mx3g-chest-lid {
  transform: translateY(-10px) rotate(-26deg);
}

.mx3g-chest-bow {
  position: absolute;
  top: -15px;
  font-size: 1.25rem;
}

.mx3g-chest-body {
  position: relative;
  z-index: 2;
  height: 48px;
  width: 84px;
  border-radius: 4px 4px 12px 12px;
  background: linear-gradient(180deg, #168039 0%, #0B5222 100%);
  border: 2px solid #FACC15;
  border-top: none;
  box-shadow: 0 10px 18px rgba(11, 50, 24, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mx3g-chest-ribbon-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 12px;
  transform: translateX(-50%);
  background: #FACC15;
}

.mx3g-chest-lock {
  position: relative;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  color: #C8161D;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.mx3g-chest-num {
  margin-top: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  color: #0F662B;
}

.mx3g-chest.is-other-revealed {
  opacity: 0.45;
  filter: grayscale(25%);
}

/* ==========================================================================
   STEP 3: REWARD & 15-MIN URGENCY TIMER
   ========================================================================== */
.mx3g-reward-card {
  text-align: center;
  padding: 8px 4px 4px;
}

.mx3g-reward-badge {
  display: inline-block;
  background: #E9F7EE;
  color: #0F662B;
  font-weight: 900;
  font-size: 0.82rem;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.mx3g-reward-icon {
  font-size: 3rem;
  line-height: 1.1;
  margin-bottom: 6px;
}

.mx3g-reward-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 900;
  color: #C8161D;
}

.mx3g-reward-desc {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: #435348;
}

.mx3g-code-box {
  background: #FFFDF4;
  border: 2.5px dashed #C8161D;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.mx3g-code-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #6C7D72;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mx3g-code-value {
  display: block;
  font-family: 'Cairo', monospace;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #0F662B;
  margin-top: 2px;
}

.mx3g-urgency {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #FEEBEC;
  border: 1px solid #F5C2C7;
  color: #A11016;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.mx3g-timer {
  background: #C8161D;
  color: #FFFFFF;
  font-family: monospace;
  font-size: 1rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 8px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.mx3g-reward-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .mx3g-body { padding: 14px 14px 20px; }
  .mx3g-reward-actions { grid-template-columns: 1fr; }
  .mx3g-chests-grid { gap: 6px; }
  .mx3g-chest-box { transform: scale(0.88); }
  .mx3g-launcher {
    bottom: 16px;
    inset-inline-end: 16px;
    padding: 10px 14px;
    font-size: 0.84rem;
  }
}


/* Active Unredeemed Promo Bar + Replay + 24h Locked Card */
.mx3g-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #FFFDF4;
  border: 1.5px dashed #168039;
  border-radius: 12px;
  padding: 8px 11px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mx3g-active-bar-info {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.mx3g-active-bar-tag {
  background: #E9F7EE;
  color: #0F662B;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.mx3g-active-bar-info strong {
  font-family: 'Cairo', monospace;
  color: #C8161D;
  font-size: 0.95rem;
  letter-spacing: 1px;
}

.mx3g-active-bar-info small {
  color: #435348;
  font-weight: 700;
}

.mx3g-active-bar-btns {
  display: flex;
  gap: 6px;
}

.mx3g-mini-btn {
  border: 1px solid #D5E2DA;
  background: #FFFFFF;
  color: #1C241E;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.mx3g-mini-btn-green {
  background: #168039;
  border-color: #168039;
  color: #FFFFFF;
}

.mx3g-btn-outline {
  background: #FFFFFF;
  color: #0F662B;
  border: 2px solid #168039;
}

.mx3g-btn-outline:hover {
  background: #E9F7EE;
}

.mx3g-replay-btn {
  margin-top: 10px;
}

.mx3g-replay-note {
  margin: 10px 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #5C6F63;
}

.mx3g-kept-promo {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #E9F7EE;
  border: 1.5px dashed #168039;
  font-size: 0.84rem;
  color: #0F662B;
  font-weight: 700;
}

.mx3g-badge-locked {
  background: #FEEBEC;
  color: #A11016;
}

.mx3g-blocked-timer-box {
  background: #FFF8F8;
  border: 2px dashed #C8161D;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.mx3g-blocked-clock {
  display: block;
  font-family: monospace;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #C8161D;
  margin-top: 4px;
}
