*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:system-ui, Segoe UI, Arial;
  color:#e7f0ff;

  /* 🎮 FOND RÉTRO GAMING */
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.035),
      rgba(255,255,255,0.035) 1px,
      rgba(0,0,0,0.035) 2px,
      rgba(0,0,0,0.035) 4px
    ),
    radial-gradient(
      circle at top,
      #1a1f3a 0%,
      #0b0f1e 40%,
      #05070b 100%
    );
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

/* 🕹️ ÉMOJIS RÉTRO */
body::before{
  content:
    "🎮   🕹️   🎰   📻   🎮   🕹️   🎰   📻   🎮   🕹️\A\A"
    "🕹️   🎰   📻   🎮   🕹️   🎰   📻   🎮   🕹️   🎰\A\A"
    "🎰   📻   🎮   🕹️   🎰   📻   🎮   🕹️   🎰   📻\A\A"
    "🎮   🕹️   🎰   📻   🎮   🕹️   🎰   📻   🎮   🕹️\A\A"
    "🕹️   🎰   📻   🎮   🕹️   🎰   📻   🎮   🕹️   🎰";
  position: fixed;
  top: 6%;
  left: 6%;
  right: 6%;
  bottom: 6%;
  font-size: 64px;
  line-height: 120px;
  letter-spacing: 48px;
  opacity: 0.32;
  pointer-events: none;
  white-space: pre-wrap;
  text-align: center;
  z-index: 0;
  filter:
    drop-shadow(0 0 10px rgba(255,255,255,0.25))
    drop-shadow(0 0 28px rgba(120,160,255,0.20));
}

/* ---------------- UI ---------------- */

.topbar{
  position: relative;
  z-index: 1;
  padding:14px 18px;
  border-bottom:1px solid rgba(255,255,255,.08);
  display:flex;
  align-items:baseline;
  justify-content:space-between;
}
.topbar h1{ margin:0; font-size:18px; }
.hint{ opacity:.75; font-size:12px; }

.layout{
  position: relative;
  z-index: 1;
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:16px;
  padding:16px;
  max-width:1100px;
  margin:0 auto;
}

/* ⬛ MENU — NOIR PLEIN */
.menu{
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  padding:12px;
  background:#000;
}

/* ⬛ BOUTONS — NOIR */
.game-btn{
  width:100%;
  padding:10px 12px;
  margin:8px 0;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.15);
  background:#000;
  color:#e7f0ff;
  cursor:pointer;
  font-weight:700;
}
.game-btn:hover{ background:#111; }

/* ⬛ PANNEAUX INFOS — NOIR */
.panel{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:#000;
}

.row{
  display:flex;
  justify-content:space-between;
  padding:6px 0;
  border-bottom:1px dashed rgba(255,255,255,.12);
}
.row:last-child{ border-bottom:none; }

.small{ margin-top:10px; font-size:12px; opacity:.85; }

.stage{
  position: relative;
  display:flex;
  justify-content:center;
  align-items:flex-start;
}

canvas{
  width:480px;
  max-width:100%;
  height:auto;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.08);
  background:#05070b;

  /* ✅ Mobile: empêche scroll/zoom pendant le jeu */
  touch-action: none;
}

.mobileHint{
  display:none;
  position:absolute;
  left:50%;
  bottom:10px;
  transform: translateX(-50%);
  font-size: 12px;
  opacity:.75;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}

.footer{
  position: relative;
  z-index: 1;
  padding:10px 16px;
  border-top:1px solid rgba(255,255,255,.08);
  text-align:center;
  opacity:.65;
  font-size:12px;
}

/* =========================
   ✅ Bouton menu flottant
========================= */
.menuToggle{
  display:none;
  position:absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.55);
  color:#e7f0ff;
  padding:10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* Overlay menu mobile */
.menuOverlay{
  display:none;
  position: fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  z-index: 9;
}

/* =========================
   ✅ RESPONSIVE + PLEIN ÉCRAN MOBILE
========================= */

@media (max-width: 900px){
  .layout{
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 900px;
  }
  .topbar{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  body::before{
    font-size: 44px;
    line-height: 90px;
    letter-spacing: 28px;
    opacity: 0.18;
  }
}

@media (max-width: 520px){
  .layout{
    padding: 10px;
    gap: 10px;
  }

  /* ✅ Le canvas doit prendre l’écran */
  .stage{
    align-items: center;
  }

  /* Canvas “grand” : on remplit la hauteur dispo */
  canvas{
    width: 96vw;
    max-width: 96vw;
    height: calc(100svh - 170px); /* topbar + marges + footer */
    max-height: calc(100svh - 170px);
    border-radius: 16px;
  }

  .menuToggle{ display:block; }
  .mobileHint{ display:block; }

  /* ✅ Quand on joue: plein écran (menu/topbar/footer cachés) */
  body.playing #topbar,
  body.playing #footer{
    display:none;
  }

  body.playing .layout{
    padding: 0;
    gap: 0;
  }

  body.playing .stage{
    position: fixed;
    inset: 0;
    padding: 0;
    margin: 0;
    display:flex;
    justify-content:center;
    align-items:center;
    z-index: 20;
    background: #05070b;
  }

  body.playing canvas{
    width: 100vw;
    height: 100svh;
    max-width: 100vw;
    max-height: 100svh;
    border-radius: 0;
    border: none;
  }

  body.playing .mobileHint{
    bottom: 14px;
  }

  /* ✅ Menu en overlay (quand ouvert) */
  body.menu-open .menuOverlay{
    display:block;
  }

  body.menu-open .menu{
    position: fixed;
    left: 10px;
    right: 10px;
    top: 70px;
    bottom: 10px;
    overflow:auto;
    z-index: 10;
    border-radius: 16px;
  }

  /* Par défaut sur mobile: menu moins intrusif (accessible via bouton) */
  .menu{
    display:none;
  }

  body.menu-open .menu{
    display:block;
  }

  body::before{
    font-size: 34px;
    line-height: 70px;
    letter-spacing: 18px;
    opacity: 0.14;
  }
}
