/* Cyber theme commun à tout jeux.m2-9.fr (cohérent avec ia.m2-9.fr) */
:root {
  --bg:        #060916;
  --bg2:       #0d1530;
  --fg:        #f5f5f7;
  --muted:     #9aa0a6;
  --cyan:      #00e5ff;
  --cyan2:     #7ff8ff;
  --magenta:   #ff2d92;
  --violet:    #7c2dff;
  --heat:      #ff7a1a;
  --gold:      #ffd28a;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% 30%, var(--bg2) 0%, var(--bg) 60%, #000 100%);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* Scanlines CRT */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom,
    rgba(255,255,255,0) 0px, rgba(255,255,255,0) 2px, rgba(255,255,255,0.025) 3px);
}
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(to bottom, rgba(6,9,22,.92), rgba(6,9,22,.4));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,229,255,.15);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; letter-spacing: .04em;
  text-shadow: 0 0 12px rgba(0,229,255,.4);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan2), var(--cyan));
  color: #001318; display: grid; place-items: center; font-weight: 900;
}
.site-nav { display: flex; gap: 22px; font-size: 14px; }
.site-nav a { opacity: .8; transition: opacity .15s, color .15s; }
.site-nav a:hover { opacity: 1; color: var(--cyan2); }

/* Cards / panels */
.neon-card {
  border: 1px solid rgba(0,229,255,.35);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(13,21,48,.6), rgba(6,9,22,.6));
  backdrop-filter: blur(8px);
  box-shadow: 0 0 24px rgba(0,229,255,.18), inset 0 0 12px rgba(0,229,255,.06);
}
.neon-card.casino { border-color: rgba(255,45,146,.35); box-shadow: 0 0 24px rgba(255,45,146,.18), inset 0 0 12px rgba(255,45,146,.06); }
.neon-card.arcade { border-color: rgba(255,122,26,.35); box-shadow: 0 0 24px rgba(255,122,26,.18), inset 0 0 12px rgba(255,122,26,.06); }

/* Boutons */
.btn-cyber {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px;
  background: linear-gradient(135deg, var(--cyan2), var(--cyan));
  color: var(--bg2); font-weight: 700; font-size: 15px;
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,229,255,.35);
  transition: transform .15s, box-shadow .15s;
}
.btn-cyber:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(0,229,255,.55); }
.btn-cyber:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-magenta {
  background: linear-gradient(135deg, var(--magenta), var(--violet));
  color: white;
  box-shadow: 0 8px 24px rgba(255,45,146,.35);
}
.btn-magenta:hover { box-shadow: 0 12px 32px rgba(255,45,146,.55); }
.btn-orange {
  background: linear-gradient(135deg, var(--gold), var(--heat));
  color: #1a0e00;
  box-shadow: 0 8px 24px rgba(255,122,26,.35);
}
.btn-orange:hover { box-shadow: 0 12px 32px rgba(255,122,26,.55); }

/* Glow texte */
.glow-cyan    { text-shadow: 0 0 14px rgba(0,229,255,.55); }
.glow-magenta { text-shadow: 0 0 14px rgba(255,45,146,.55); }
.glow-orange  { text-shadow: 0 0 14px rgba(255,122,26,.55); }

/* Hero (page index) */
.hero {
  min-height: calc(100vh - 70px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(40px, 7vw, 84px); margin: 0 0 14px;
  font-weight: 900; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff 0%, #c9c9d0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lede { color: var(--muted); margin: 0 0 36px; font-size: 17px; }

/* Grille de jeux */
.game-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-width: 1100px; margin: 0 auto; padding: 24px;
}
.game-card {
  display: block; padding: 22px;
  text-decoration: none; color: inherit;
  border-radius: 14px;
  transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.game-card:hover { transform: translateY(-3px); }
.game-card .emoji { font-size: 56px; margin-bottom: 10px; display: block; line-height: 1; }
.game-card .title { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.game-card .desc  { color: var(--muted); font-size: 13px; }
.game-card .badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-family: ui-monospace, monospace; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0,229,255,.15); border: 1px solid rgba(0,229,255,.4); color: var(--cyan2);
}
.game-card.disabled { opacity: .5; pointer-events: none; }
.game-card.disabled .badge { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.2); color: var(--muted); }

/* Game wrapper (page jeu) */
.game-wrap {
  max-width: 720px; margin: 30px auto; padding: 0 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.game-wrap h1 {
  margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.01em;
}
.game-wrap .sub { color: var(--muted); margin-top: -10px; font-size: 14px; }
.score-bar {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  font-family: ui-monospace, monospace; font-size: 14px;
}
.score-bar .stat {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(13,21,48,.5);
}
.score-bar .stat b { color: var(--cyan2); font-weight: 700; }

/* Footer */
.site-footer {
  text-align: center; padding: 30px 20px;
  color: rgba(255,255,255,.3); font-size: 12px;
  font-family: ui-monospace, monospace;
}
.site-footer a:hover { color: var(--cyan2); }

/* ── Mode plein écran : maximisé pour mobile + desktop ─────────────────── */

/* Tous les canvas de jeu sont responsive par défaut */
canvas[id] {
  max-width: 100%;
  height: auto;
  touch-action: none;          /* empêche scroll/zoom navigateur sur les jeux */
}

/* Bouton flottant "Plein écran" injecté par auth.js */
.fs-toggle {
  position: fixed; bottom: 16px; right: 16px; z-index: 999;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(13, 21, 48, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--cyan2);
  font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform .15s, background .15s, box-shadow .15s;
}
.fs-toggle:hover {
  background: rgba(0, 229, 255, 0.2);
  transform: scale(1.08);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.4);
}
.fs-toggle:active { transform: scale(0.95); }

/* Quand le body est en plein écran ou que l'API Fullscreen est active */
body.is-fullscreen .site-header,
body.is-fullscreen .site-footer,
:fullscreen .site-header,
:fullscreen .site-footer {
  display: none;
}
/* Le wrapper de jeu prend toute la place dispo */
body.is-fullscreen .game-wrap,
:fullscreen .game-wrap {
  margin: 0; padding: 8px;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
}
/* Canvas remplit l'espace dispo (en respectant l'aspect ratio par max-width/height) */
body.is-fullscreen canvas[id],
:fullscreen canvas[id] {
  max-width: 100vw;
  max-height: calc(100dvh - 80px);   /* garde la place pour score-bar / overlay */
  width: auto; height: auto;
}
/* score-bar plus compact en fullscreen */
body.is-fullscreen .score-bar,
:fullscreen .score-bar {
  font-size: 12px;
  gap: 8px;
}
body.is-fullscreen .score-bar .stat,
:fullscreen .score-bar .stat {
  padding: 4px 10px;
}
/* Cache la sub-line + paytable en fullscreen pour gagner de l'espace */
body.is-fullscreen .game-wrap .sub,
body.is-fullscreen .game-wrap h1,
body.is-fullscreen .paytable,
:fullscreen .game-wrap .sub,
:fullscreen .game-wrap h1,
:fullscreen .paytable { display: none; }

/* Optimisations mobile : désactive le bounce iOS et le pull-to-refresh */
@media (max-width: 720px) {
  body { overscroll-behavior: none; }
  /* Sur mobile, un peu plus de marge utile */
  .game-wrap { padding: 8px; }
}

/* ── Annonce de résultat + confettis (partagés sur tous les jeux) ───── */
#m2jConfetti {
  position: fixed; inset: 0; pointer-events: none; z-index: 998;
  width: 100%; height: 100%;
}
.m2j-result-pop {
  position: fixed; inset: 0; z-index: 999;
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
  padding: 16px;
}
.m2j-result-pop.show { display: flex; animation: m2jFade .35s ease; }
@keyframes m2jFade { from { opacity: 0; } }
.m2j-result-card {
  pointer-events: auto;
  padding: 28px 44px; border-radius: 20px; text-align: center;
  background: linear-gradient(180deg, rgba(40,10,30,.98), rgba(10,5,20,.98));
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
  transform-origin: center;
  animation: m2jPop .55s cubic-bezier(.2,.9,.2,1.2);
  max-width: 90vw; cursor: pointer;
}
@keyframes m2jPop { from { transform: scale(.5) rotate(-8deg); opacity: 0; } }
.m2j-result-card.win  {
  border: 3px solid var(--gold);
  box-shadow: 0 0 60px rgba(255,210,138,.6), 0 30px 80px rgba(0,0,0,.7);
}
.m2j-result-card.lose {
  border: 3px solid var(--magenta);
  box-shadow: 0 0 40px rgba(255,45,146,.4), 0 30px 80px rgba(0,0,0,.7);
}
.m2j-result-card.push {
  border: 3px solid var(--cyan);
  box-shadow: 0 0 40px rgba(0,229,255,.4), 0 30px 80px rgba(0,0,0,.7);
}
.m2j-result-card .m2j-title {
  font-family: ui-monospace, monospace; font-size: 18px;
  letter-spacing: .15em; color: var(--muted); margin-bottom: 6px;
}
.m2j-result-card .m2j-amount {
  font-size: clamp(38px, 7vw, 64px); font-weight: 900;
  line-height: 1; margin: 6px 0;
  background: linear-gradient(180deg, var(--gold), var(--heat));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(255,210,138,.4);
}
.m2j-result-card.lose .m2j-amount {
  background: linear-gradient(180deg, #ff6479, var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.m2j-result-card.push .m2j-amount {
  background: linear-gradient(180deg, #7ff8ff, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.m2j-result-card .m2j-label {
  font-family: ui-monospace, monospace; text-transform: uppercase;
  letter-spacing: .2em; font-size: 13px; color: var(--fg);
  opacity: .85; margin-top: 6px;
}
.m2j-result-card .m2j-sub {
  font-size: 13px; color: var(--muted); margin-top: 8px;
  font-family: ui-monospace, monospace;
}
