/* ===============================
   Machine à sous « Mister Slots »
   =============================== */

#ms-root {
  /* Taille d'une case : la machine tient dans la fenêtre sans ascenseur
     (en-tête du site, titre et marges déduits de la hauteur) */
  --cell: clamp(62px, min(calc((100vh - 395px) / 3), calc((92vw - 470px) / 3)), 128px);
  --pink: #ff3fa4;
  --cyan: #3ff0ff;
  --gold: #ffc83d;
  --violet: #7b3dff;
  --cab1: #2b0f52;
  --cab2: #120524;
  --ink: #f4eaff;
  /* Barre commune (css/games.css) aux couleurs de la borne */
  --mg-jeu-largeur: 920px;
  --mgb-fond: radial-gradient(120% 160% at 0% 0%, rgba(255, 63, 164, 0.3), transparent 55%),
    linear-gradient(120deg, var(--cab2), var(--cab1));
  --mgb-accent: var(--cyan);
  --mgb-titre: linear-gradient(100deg, #ffffff, #ff8ad0 45%, var(--cyan));
  --mgb-ombre: 0 0 18px rgba(123, 61, 255, 0.4);
  --mg-fs-fond: radial-gradient(circle at 50% 30%, #3d1473, #0b0316 70%);
  --mg-bulle-fond: var(--cab2);
  position: relative;
  margin: 14px auto 10px auto;
  font-family: "Madimi One", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.ms-stage {
  display: flex;
  justify-content: center;
}

/* ---------- Borne ---------- */

.ms-cabinet {
  position: relative;
  box-sizing: border-box;
  padding: 12px 16px 14px 16px;
  margin-right: 90px; /* place du levier */
  margin-left: 90px;
  border-radius: 30px 30px 24px 24px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 63, 164, 0.22), transparent 60%),
    linear-gradient(180deg, var(--cab1), var(--cab2));
  border: 3px solid #5c2ca3;
  box-shadow:
    0 0 0 4px #1a0833,
    0 0 26px rgba(123, 61, 255, 0.55),
    0 16px 34px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.15);
  transition: box-shadow 0.4s, border-color 0.4s;
}

.ms-cabinet.ms-freemode {
  border-color: var(--gold);
  box-shadow:
    0 0 0 4px #3a2400,
    0 0 36px rgba(255, 200, 61, 0.75),
    0 16px 34px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.15);
}

/* ---------- Fronton ---------- */

.ms-marquee {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 12px 8px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #3d1473, #1f0a3d);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), inset 0 -8px 18px rgba(0, 0, 0, 0.35);
}

.ms-bulbs {
  position: absolute;
  top: 7px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
}

.ms-bulbs i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffe9a8;
  box-shadow: 0 0 6px #ffcf4a, 0 0 12px #ffb300;
  animation: ms-chase 1.6s linear infinite;
  animation-delay: calc(var(--i) * -0.16s);
}

.ms-party .ms-bulbs i {
  animation-duration: 0.5s;
  background: #fff;
}

@keyframes ms-chase {
  0%, 60% { opacity: 1; }
  70%, 100% { opacity: 0.22; box-shadow: none; }
}

.ms-sign {
  font-size: 1.9em;
  letter-spacing: 2px;
  line-height: 1.1;
  white-space: nowrap;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--pink), 0 0 24px var(--pink);
  animation: ms-neon 6s infinite;
}

.ms-sign span {
  color: #eaffff;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--cyan), 0 0 24px var(--cyan);
}

@keyframes ms-neon {
  0%, 18%, 22%, 62%, 64%, 100% { opacity: 1; }
  20%, 63% { opacity: 0.55; }
}

.ms-jackpot {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 14px;
  border-radius: 999px;
  background: #0b0316;
  border: 2px solid var(--gold);
  box-shadow: 0 0 12px rgba(255, 200, 61, 0.45), inset 0 0 10px rgba(255, 200, 61, 0.2);
  white-space: nowrap;
}

.ms-jackpot-lbl {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffe7a3;
}

.ms-jackpot-val {
  font-size: 1.3em;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 200, 61, 0.8);
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
}

/* ---------- Corps : rouleaux + console ---------- */

.ms-body {
  position: relative;
  display: grid;
  grid-template-columns: auto 230px;
  gap: 16px;
  margin-top: 12px;
}

.ms-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* ---------- Rouleaux ---------- */

.ms-window {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 6px;
}

.ms-reels {
  position: relative;
  display: flex;
  padding: 6px;
  border-radius: 18px;
  background: linear-gradient(180deg, #d9d9e6, #8b8ba3);
  box-shadow: 0 0 0 3px #0b0316, 0 0 18px rgba(63, 240, 255, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.7);
}

.ms-reel {
  position: relative;
  width: var(--cell);
  height: calc(var(--cell) * 3);
  overflow: hidden;
  background: linear-gradient(90deg, #efe9dc, #fffdf8 30%, #fffdf8 70%, #efe9dc);
  border-left: 2px solid #2a1840;
  transition: box-shadow 0.3s;
}

.ms-reel:first-child {
  border-left: 0;
  border-radius: 12px 0 0 12px;
}

.ms-reel:nth-child(3) {
  border-radius: 0 12px 12px 0;
}

/* Ombrage cylindrique */
.ms-reel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(20, 5, 40, 0.55) 0%,
    rgba(20, 5, 40, 0) 22%,
    rgba(20, 5, 40, 0) 78%,
    rgba(20, 5, 40, 0.55) 100%
  );
  z-index: 2;
}

.ms-reel.ms-antic {
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 26px rgba(255, 200, 61, 0.9);
  animation: ms-antic 0.35s ease-in-out infinite alternate;
}

@keyframes ms-antic {
  to { box-shadow: inset 0 0 0 3px #fff, inset 0 0 40px rgba(255, 63, 164, 0.9); }
}

.ms-reel.ms-bump .ms-strip {
  animation: ms-bump 0.22s ease-out;
}

@keyframes ms-bump {
  0% { translate: 0 3px; }
  100% { translate: 0 0; }
}

.ms-strip {
  will-change: transform;
}

.ms-strip.ms-blur {
  filter: blur(1.4px);
}

.ms-sym {
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.56);
  line-height: 1;
  user-select: none;
  position: relative;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.ms-sym.hit {
  z-index: 3;
  animation: ms-hit 0.75s ease-in-out infinite;
}

.ms-sym.hit::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 18%;
  background: radial-gradient(circle, rgba(255, 220, 90, 0.75), rgba(255, 63, 164, 0.15) 70%, transparent 72%);
  z-index: -1;
}

@keyframes ms-hit {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14) rotate(-4deg); }
}

.ms-seven {
  font-family: "Madimi One", sans-serif;
  font-size: 1.15em;
  color: #ff2a55;
  background: linear-gradient(180deg, #ff7a8f, #e0002c 55%, #8a0019);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #4d0010) drop-shadow(0 0 1px #000);
}

.ms-wild {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Madimi One", sans-serif;
  font-size: 0.4em;
  letter-spacing: 1px;
  padding: 0.45em 0.5em;
  border-radius: 0.5em;
  color: #fff;
  background: linear-gradient(135deg, #ff3fa4, #7b3dff 50%, #3ff0ff);
  box-shadow: 0 2px 0 #2b0f52, 0 0 10px rgba(123, 61, 255, 0.6);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-8deg);
}

.ms-sym[data-s="S"] {
  filter: drop-shadow(0 0 6px rgba(255, 190, 0, 0.8));
}

.ms-sym[data-s="D"] {
  filter: drop-shadow(0 0 6px rgba(63, 200, 255, 0.8));
}

/* Lignes de paiement */
.ms-paylines {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.ms-paylines polyline {
  fill: none;
  stroke: var(--c);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px var(--c));
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: ms-draw 0.45s ease-out forwards;
  opacity: 0.9;
}

.ms-paylines polyline.pv {
  stroke-width: 3;
  stroke-dasharray: 8 6;
  stroke-dashoffset: 0;
  animation: none;
}

@keyframes ms-draw {
  to { stroke-dashoffset: 0; }
}

.ms-linetags {
  position: relative;
  flex: 0 0 24px;
}

.ms-tag {
  position: absolute;
  left: 0;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  color: #120524;
  background: var(--c);
  box-shadow: 0 0 0 2px #0b0316;
  opacity: 0.55;
  cursor: help;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}

.ms-tag.on {
  opacity: 1;
  transform: scale(1.18);
  box-shadow: 0 0 0 2px #0b0316, 0 0 12px var(--c);
}

/* ---------- Messages ---------- */

.ms-msg {
  /* Hauteur fixe : les symboles affichés en cas de gain ne décalent rien */
  height: 34px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
  padding: 0 12px;
  border-radius: 12px;
  background: #0b0316;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 1em;
  color: #cbb8ea;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ms-msg b {
  color: var(--gold);
  font-weight: normal;
  text-shadow: 0 0 8px rgba(255, 200, 61, 0.7);
}

.ms-msg-win {
  color: #fff;
  animation: ms-pop 0.35s ease-out;
}

.ms-msg-free {
  color: #ffe7a3;
}

.ms-msg-line {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--c);
  color: #120524;
  font-size: 0.85em;
}

.ms-msg-syms {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.1em;
  line-height: 1;
  height: 1em;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ms-msg-syms .ms-wild {
  font-size: 0.45em;
}

@keyframes ms-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---------- Console ---------- */

.ms-console {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.ms-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ms-led {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 4px;
  border-radius: 12px;
  background: linear-gradient(180deg, #0d0419, #1a0833);
  box-shadow: inset 0 0 0 1px rgba(63, 240, 255, 0.25), inset 0 4px 10px rgba(0, 0, 0, 0.5);
  min-width: 0;
}

.ms-led-bet {
  grid-column: 1 / -1;
}

.ms-led-lbl {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #9d86c7;
}

.ms-led-lbl small {
  text-transform: none;
  letter-spacing: 0;
  color: #7a66a0;
  margin-left: 4px;
}

.ms-led-val {
  font-size: 1.3em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(63, 240, 255, 0.7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ms-led-win {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 200, 61, 0.7);
}

.ms-bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

.ms-round {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: 1.1em;
  line-height: 1;
  color: #120524;
  background: linear-gradient(180deg, #8ff7ff, #26b8cc);
  box-shadow: 0 2px 0 #0f6470;
  cursor: pointer;
}

.ms-round:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}

.ms-round:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Bouton Jouer */
.ms-spin {
  --size: clamp(66px, calc(var(--cell) * 0.95), 104px);
  align-self: center;
  flex: 0 0 auto;
  width: var(--size);
  height: var(--size);
  margin: 6px 0;
  border-radius: 50%;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: calc(var(--size) * 0.22);
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #ff8acb, var(--pink) 45%, #a3005a);
  box-shadow:
    0 0 0 4px #0b0316,
    0 0 0 7px #ff8acb,
    0 6px 0 7px #6b003a,
    0 0 26px 8px rgba(255, 63, 164, 0.55);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.1s, filter 0.2s;
  animation: ms-breathe 2.2s ease-in-out infinite;
}

.ms-spin:hover:not(:disabled) {
  filter: brightness(1.12);
}

.ms-spin:active:not(:disabled) {
  transform: translateY(4px) scale(0.97);
}

.ms-spin:disabled {
  filter: grayscale(0.6) brightness(0.8);
  animation: none;
  cursor: default;
}

.ms-spin.ms-spin-stop {
  background: radial-gradient(circle at 50% 35%, #9ff, #1ec8dc 45%, #006a78);
  box-shadow:
    0 0 0 4px #0b0316,
    0 0 0 7px #9ff,
    0 6px 0 7px #004a54,
    0 0 26px 8px rgba(63, 240, 255, 0.5);
}

@keyframes ms-breathe {
  50% { filter: brightness(1.15); }
}

.ms-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ms-pill {
  font: inherit;
  font-size: 0.85em;
  line-height: 1.15;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  color: #f4eaff;
  background: linear-gradient(180deg, #5b2aa8, #3a1478);
  box-shadow: 0 3px 0 #1f0a3d, inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.1s;
}

.ms-pill:hover:not(:disabled) {
  filter: brightness(1.2);
}

.ms-pill:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 0 0 #1f0a3d;
}

.ms-pill:disabled {
  opacity: 0.4;
  cursor: default;
}

.ms-pill.on {
  background: linear-gradient(180deg, #ff6dbb, #c4127a);
  box-shadow: 0 3px 0 #5e0839, 0 0 14px rgba(255, 63, 164, 0.6);
}

.ms-pill-gold {
  color: #2b1600;
  background: linear-gradient(180deg, #ffe07a, #f0a800);
  box-shadow: 0 3px 0 #7a4c00, inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#ms-gamble:not(:disabled) {
  animation: ms-glow 1s ease-in-out infinite alternate;
}

@keyframes ms-glow {
  to { box-shadow: 0 3px 0 #7a4c00, 0 0 16px rgba(255, 200, 61, 0.9); }
}

/* Objectif */
.ms-goal-lbl {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  color: #9d86c7;
  margin-bottom: 3px;
}

.ms-goal-lbl b {
  font-weight: normal;
  color: var(--gold);
}

.ms-goal-bar {
  height: 9px;
  border-radius: 999px;
  background: #0b0316;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ms-goal-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--gold));
  box-shadow: 0 0 10px rgba(255, 63, 164, 0.7);
  transition: width 0.8s ease;
}

/* ---------- Levier ---------- */
/* Fixé sur le flanc droit de la borne, à hauteur des rouleaux.
   Tiré : le bras bascule vers le bas et la boule passe sous le pivot. */

.ms-lever {
  --arm: calc(var(--cell) * 1.9);
  position: absolute;
  top: 0;
  right: -109px; /* marge intérieure + bordure de la borne + largeur du levier */
  width: 90px;
  height: calc(var(--cell) * 3 + 12px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

/* Boîtier du pivot, collé à la borne */
.ms-lever-base {
  position: absolute;
  left: 0;
  top: calc(var(--arm) + 6px);
  width: 28px;
  height: 70px;
  margin-top: -35px;
  border-radius: 0 16px 16px 0;
  background: linear-gradient(90deg, #5a5a70, #d6d6e4 45%, #6b6b80);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  z-index: 2;
}

/* Axe horizontal qui écarte le bras de la borne, et moyeu du pivot */
.ms-lever::before,
.ms-lever::after {
  content: "";
  position: absolute;
  top: calc(var(--arm) + 6px);
  z-index: 2;
}

.ms-lever::before {
  left: 20px;
  width: 40px;
  height: 20px;
  margin-top: -10px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, #6b6b80, #e6e6f0 45%, #5a5a70);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

.ms-lever::after {
  left: 58px;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #b8b8cc 45%, #5a5a70);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.ms-lever-arm {
  position: absolute;
  left: 50px;
  top: 6px;
  width: 16px;
  height: var(--arm);
  border-radius: 8px;
  background: linear-gradient(90deg, #7d7d95, #f5f5fb 40%, #9a9ab0 70%, #6d6d85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  transform-origin: 50% 100%;
  transition: transform 0.38s cubic-bezier(0.3, 1.5, 0.5, 1);
  z-index: 1;
}

.ms-lever-knob {
  position: absolute;
  left: 58px;
  top: 6px;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffc2e2, var(--pink) 50%, #8a0048);
  box-shadow: 0 0 18px rgba(255, 63, 164, 0.75), 0 4px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.38s cubic-bezier(0.3, 1.5, 0.5, 1), filter 0.3s;
  z-index: 3;
}

.ms-lever:hover .ms-lever-knob {
  filter: brightness(1.15);
}

.ms-lever.pulled .ms-lever-arm {
  transform: scaleY(-0.6);
  transition: transform 0.17s ease-in;
}

.ms-lever.pulled .ms-lever-knob {
  transform: translateY(calc(var(--arm) * 1.6)) scale(1.12);
  transition: transform 0.17s ease-in;
}

.ms-lever.off {
  cursor: default;
}

/* ---------- Voiles ---------- */

.ms-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(10, 2, 22, 0.72);
  cursor: pointer;
}

.ms-overlay[hidden] {
  display: none;
}

.ms-overlay.show .ms-overlay-box {
  animation: ms-zoom 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes ms-zoom {
  from { transform: scale(0.3) rotate(-6deg); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ms-overlay-box {
  text-align: center;
  padding: 20px 26px;
  max-width: 86%;
}

.ms-ov-title {
  font-size: clamp(2em, 7vw, 3.6em);
  line-height: 1.05;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 6px #fff, 0 0 18px var(--pink), 0 0 36px var(--pink), 0 4px 0 #6b003a;
}

.ms-ov-amount {
  margin-top: 10px;
  font-size: clamp(2.2em, 8vw, 3.8em);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255, 200, 61, 0.9), 0 4px 0 #6b4200;
}

.ms-ov-sub {
  margin-top: 10px;
  font-size: 1.1em;
  color: #e6d8ff;
}

.ms-ov-sub b {
  color: var(--gold);
  font-weight: normal;
}

.ms-ov-stars {
  margin-top: 8px;
  font-size: 2.4em;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  animation: ms-hit 0.9s ease-in-out infinite;
}

.ms-ov-hint {
  margin-top: 14px;
  font-size: 0.85em;
  color: #9d86c7;
}

.ms-ov-l3 .ms-ov-title,
.ms-ov-jackpot .ms-ov-title {
  animation: ms-rainbow 1.2s linear infinite;
}

@keyframes ms-rainbow {
  0% { text-shadow: 0 0 6px #fff, 0 0 20px var(--pink), 0 0 40px var(--pink), 0 4px 0 #6b003a; }
  33% { text-shadow: 0 0 6px #fff, 0 0 20px var(--cyan), 0 0 40px var(--cyan), 0 4px 0 #004a54; }
  66% { text-shadow: 0 0 6px #fff, 0 0 20px var(--gold), 0 0 40px var(--gold), 0 4px 0 #6b4200; }
  100% { text-shadow: 0 0 6px #fff, 0 0 20px var(--pink), 0 0 40px var(--pink), 0 4px 0 #6b003a; }
}

.ms-ov-free .ms-ov-title {
  text-shadow: 0 0 6px #fff, 0 0 18px var(--gold), 0 0 36px var(--gold), 0 4px 0 #6b4200;
}

.ms-ov-lose .ms-ov-title {
  text-shadow: 0 0 6px #fff, 0 0 18px #7b3dff, 0 0 36px #7b3dff;
}

.ms-overlay .ms-modal-btns {
  margin-top: 16px;
}

/* ---------- Fenêtres ---------- */

.ms-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 2, 22, 0.6);
}

.ms-modal[hidden] {
  display: none;
}

.ms-modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, #2b0f52, #150628);
  border: 2px solid #5c2ca3;
  box-shadow: 0 0 30px rgba(123, 61, 255, 0.5);
  color: var(--ink);
  animation: ms-zoom 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.ms-modal-title {
  text-align: center;
  font-size: 1.6em;
  color: #fff;
  text-shadow: 0 0 10px var(--pink);
  margin-bottom: 10px;
}

.ms-modal-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.ms-modal-btns .ms-pill {
  padding: 10px 18px;
  font-size: 1em;
}

/* Aide : large, sur deux colonnes, pour tenir sans ascenseur */
.ms-help-box {
  max-width: 1040px;
  padding: 16px 24px 16px 24px;
}

.ms-help-box .ms-modal-title {
  margin-bottom: 8px;
}

/* Les 4 étapes côte à côte */
.ms-help-steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.86em;
  line-height: 1.35;
  color: #ddd0f5;
}

.ms-help-steps li {
  counter-increment: step;
  position: relative;
  padding: 8px 10px 8px 36px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.ms-help-steps li::before {
  content: counter(step);
  position: absolute;
  left: 9px;
  top: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Madimi One", sans-serif;
  font-size: 0.9em;
  color: #120524;
  background: var(--pink);
}

.ms-help-steps b,
.ms-pt-rules b {
  color: var(--gold);
}

.ms-help-cols {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 26px;
}

.ms-help-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 7px 0;
  padding-bottom: 4px;
  font-size: 1.05em;
  color: var(--cyan);
  border-bottom: 1px solid rgba(63, 240, 255, 0.25);
}

.ms-pt-note {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.75em;
  color: #b9a6dc;
}

.ms-pt-note b {
  color: var(--gold);
}

.ms-help-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

/* Le jackpot occupe la case libre à côté des cerises */
.ms-help-box .ms-pt-jp {
  grid-column: auto;
}

.ms-help-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.ms-help-foot .ms-pill {
  padding: 10px 22px;
  font-size: 1em;
}

.ms-help-foot .ms-pt-stats {
  margin: 0;
  text-align: left;
}

.ms-pt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ms-pt-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
}

.ms-pt-syms {
  display: inline-flex;
  align-items: center;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.15em;
  gap: 1px;
  min-width: 3.6em;
}

.ms-pt-syms .ms-wild {
  font-size: 0.42em;
  padding: 0.4em 0.35em;
  transform: none;
}

.ms-pt-syms .ms-seven {
  font-size: 1.05em;
  padding: 0 0.08em;
}

.ms-pt-any {
  font-family: "Madimi One", sans-serif;
  color: #8a76b0;
  width: 1.2em;
  text-align: center;
}

.ms-pt-mult {
  color: var(--cyan);
  font-size: 0.9em;
}

.ms-pt-val {
  color: var(--gold);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ms-pt-jp {
  grid-column: 1 / -1;
  border: 1px solid var(--gold);
  box-shadow: 0 0 10px rgba(255, 200, 61, 0.3);
}

.ms-pt-rules {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.88em;
  line-height: 1.45;
  color: #ddd0f5;
}

.ms-pt-rules p {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.ms-pt-ico {
  flex: 0 0 2.2em;
  text-align: center;
  font-size: 1.3em;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.ms-pt-ico .ms-wild {
  font-size: 0.45em;
  transform: none;
}

.ms-key {
  flex: 0 0 4.2em;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 3px;
  font-size: 0.9em;
  color: #fff;
}

.ms-pt-lines {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.ms-pt-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.8em;
  color: var(--c);
}

.ms-pt-line svg {
  width: 40px;
  height: 40px;
}

.ms-pt-line rect {
  fill: rgba(0, 0, 0, 0.35);
  stroke: rgba(255, 255, 255, 0.15);
}

.ms-pt-line polyline {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ms-pt-stats {
  margin-top: 14px;
  text-align: center;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.8em;
  color: #9d86c7;
}

.ms-pt-stats b {
  color: #e6d8ff;
}

/* Quitte ou double */
.ms-gamble-box {
  max-width: 380px;
  text-align: center;
}

.ms-gb-stake {
  font-size: 1.1em;
}

.ms-gb-stake b {
  color: var(--gold);
  font-weight: normal;
  font-size: 1.3em;
}

#ms-gb-next {
  display: block;
  min-height: 1.3em; /* garde sa place quand il est vide (perdu) : la modale ne change pas de hauteur */
  font-size: 0.75em;
  color: #9d86c7;
}

.ms-gb-history {
  min-height: 1.5em; /* hauteur d'une pastille : pas de saut à la première carte */
  margin: 6px 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  font-family: "Segoe UI Symbol", "Segoe UI", sans-serif;
}

.ms-gb-h {
  width: 1.5em;
  height: 1.5em;
  border-radius: 6px;
  background: #fff;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ms-gb-h.red {
  color: #d4002a;
}

.ms-card {
  width: 120px;
  height: 170px;
  margin: 8px auto;
  perspective: 700px;
}

.ms-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.ms-card.flipped .ms-card-inner {
  transform: rotateY(180deg);
}

.ms-card-back,
.ms-card-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.ms-card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, var(--pink), var(--violet));
  border: 5px solid #fff;
  box-sizing: border-box;
}

.ms-card-front {
  transform: rotateY(180deg);
  background: #fff;
  color: #111;
  font-family: "Segoe UI Symbol", "Segoe UI", Arial, sans-serif;
}

.ms-card-front.red {
  color: #d4002a;
}

.ms-card-front .c-tl,
.ms-card-front .c-br {
  position: absolute;
  font-size: 1em;
  font-weight: bold;
  line-height: 1.05;
  text-align: center;
}

.ms-card-front .c-tl {
  top: 8px;
  left: 10px;
}

.ms-card-front .c-br {
  bottom: 8px;
  right: 10px;
  transform: rotate(180deg);
}

.ms-card-front .c-mid {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.6em;
}

.ms-gb-result {
  min-height: 1.4em;
  font-size: 1.1em;
  color: #e6d8ff;
}

.ms-gb-result.ok {
  color: #7dff6b;
  text-shadow: 0 0 10px rgba(125, 255, 107, 0.6);
}

.ms-gb-result.ko {
  color: #ff7a8f;
}

.ms-gb-red {
  background: linear-gradient(180deg, #ff5a78, #b3001f);
  box-shadow: 0 3px 0 #5c0010;
}

.ms-gb-black {
  background: linear-gradient(180deg, #555, #111);
  box-shadow: 0 3px 0 #000;
}

/* Pièces et confettis */
.ms-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* ---------- Plein écran ---------- */

#ms-root.mg-fs {
  --cell: clamp(62px, min(calc((100vh - 290px) / 3), calc((100vw - 520px) / 3)), 220px);
}

#ms-root.mg-fs .ms-stage {
  margin: auto 0;
}

#ms-root.mg-fs .ms-body {
  grid-template-columns: auto clamp(230px, calc(var(--cell) * 2), 300px);
}

#ms-root.mg-fs .ms-sign {
  font-size: 2.4em;
}

/* ---------- Écrans étroits : rouleaux au-dessus de la console ---------- */

@media (max-width: 800px) {
  .ms-help-steps {
    grid-template-columns: 1fr 1fr;
  }
  .ms-help-cols {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .ms-help-foot {
    flex-direction: column;
  }
  .ms-help-foot .ms-pt-stats {
    text-align: center;
  }
  #ms-root,
  #ms-root.mg-fs {
    --cell: clamp(58px, calc((100vw - 150px) / 3), 112px);
  }
  .ms-cabinet {
    margin: 0;
    width: 100%;
    max-width: 480px;
    padding: 10px 10px 12px 10px;
  }
  .ms-lever {
    display: none;
  }
  .ms-marquee {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    padding: 24px 10px 10px 10px;
  }
  .ms-sign {
    flex-basis: 100%;
    text-align: center;
    font-size: 1.6em;
  }
  .ms-jackpot {
    padding: 2px 10px;
  }
  .ms-jackpot-dia {
    display: none;
  }
  .ms-msg {
    font-size: 0.85em;
    padding: 0 8px;
  }
  
  
  
  .ms-body,
  #ms-root.mg-fs .ms-body {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .ms-console {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 12px;
  }
  .ms-panel {
    grid-template-columns: 1fr 1fr;
  }
  .ms-spin {
    --size: 84px;
    grid-row: span 2;
    margin: 6px;
  }
  .ms-goal {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .ms-linetags {
    flex-basis: 18px;
  }
  .ms-tag {
    width: 18px;
    height: 18px;
    margin-top: -9px;
    font-size: 0.65em;
  }
  .ms-pt-grid {
    grid-template-columns: 1fr;
  }
  .ms-spin {
    --size: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-bulbs i,
  .ms-sign,
  .ms-spin,
  .ms-sym.hit {
    animation: none;
  }
}
