/* ===============================
   Billard – styles spécifiques
   =============================== */

:root {
  --bl-vert: #1c7a4a;
  --bl-vert-fonce: #125a35;
  --bl-bois: #6d3f1f;
  --bl-encre: #23312a;
  --bl-or: #f4c542;
}

/* ---------- Barre commune (css/games.css) aux couleurs du tapis ---------- */
.bl-jeu {
  --mg-jeu-largeur: 1124px;
  --mgb-fond: radial-gradient(120% 160% at 0% 0%, rgba(244, 197, 66, 0.2), transparent 55%),
    linear-gradient(120deg, #101a15, var(--bl-vert-fonce));
  --mgb-accent: var(--bl-or);
  --mgb-titre: linear-gradient(100deg, #ffffff, var(--bl-or));
  --mg-fs-fond: radial-gradient(circle at 50% 40%, #2e4a3a, #101a15);
  --mg-bulle-fond: var(--bl-encre);
}

.bl-jeu .bl-panel {
  width: 100%;
  margin-top: 0;
}

/* ---------- Configuration ---------- */

.bl-panel {
  max-width: 620px;
  margin: 14px auto 36px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 22px 32px 30px 32px;
  box-sizing: border-box;
}

.bl-intro {
  color: #555;
  line-height: 1.5;
  margin-bottom: 20px;
}

.bl-row {
  margin-bottom: 18px;
}

.bl-row[hidden] {
  display: none;
}

.bl-label {
  font-weight: bold;
  font-size: 0.95em;
  margin-bottom: 10px;
  color: #3a4250;
}

.bl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bl-chips button {
  border: 2px solid #d3e2d9;
  background: #f4f8f5;
  color: #333;
  border-radius: 22px;
  padding: 9px 18px;
  font-size: 0.95em;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.bl-chips button:hover {
  border-color: #86c3a0;
}

.bl-chips button.sel {
  background: var(--bl-vert);
  border-color: var(--bl-vert);
  color: #fff;
}

.bl-start-row {
  text-align: center;
  padding-top: 8px;
}

.bl-start-row .bl-play {
  font-size: 1.1em;
  padding: 8px 34px;
}

/* Bouton principal */
.bl-play {
  font-family: "Madimi One", sans-serif;
  font-size: 1.3em;
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--bl-vert);
  border: none;
  border-radius: 30px;
  padding: 12px 54px;
  cursor: pointer;
  box-shadow:
    0 4px 0 var(--bl-vert-fonce),
    0 6px 14px rgba(28, 122, 74, 0.35);
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    background 0.15s;
}

.bl-play:hover {
  background: #22905a;
}

.bl-play:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 var(--bl-vert-fonce),
    0 2px 6px rgba(28, 122, 74, 0.3);
}

/* Boutons secondaires */
.bl-btn {
  font-size: 0.95em;
  color: var(--bl-vert);
  background: #fff;
  border: 2px solid #c8dccf;
  border-radius: 22px;
  padding: 8px 16px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.bl-btn:hover {
  background: #eef7f1;
  border-color: var(--bl-vert);
}

.bl-btn-danger {
  color: #c62828;
  border-color: #ecc4c4;
}

.bl-btn-danger:hover {
  background: #fdeeee;
  border-color: #c62828;
}

/* ---------- Écran de jeu ---------- */

.bl-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 6px;
  user-select: none;
  -webkit-user-select: none;
}

/* Bandeau des joueurs */
/* Bandeau des joueurs, dans la barre commune */
.bl-bar {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  max-width: 720px;
}

.bl-player {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 10px 4px 10px;
  border-radius: 10px;
  opacity: 0.55;
  transition:
    opacity 0.2s,
    background 0.2s;
  position: relative;
}

.bl-player.actif {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.bl-player.actif::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--bl-or);
}

.bl-pname {
  font-weight: 700;
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bl-pinfo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 26px;
  margin-top: 2px;
}

.bl-score {
  font-family: "Madimi One", sans-serif;
  font-size: 1.55em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.bl-group-lbl {
  font-size: 0.78em;
  color: #c9d3cd;
  margin-right: 4px;
}

/* Mini-billes dans le bandeau */
.bl-mb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--c);
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.4),
    inset 2px 2px 3px rgba(255, 255, 255, 0.25);
  transition:
    filter 0.3s,
    opacity 0.3s;
}

.bl-mb.raye {
  background: linear-gradient(#f6f2e6 24%, var(--c) 24%, var(--c) 76%, #f6f2e6 76%);
}

/* Numéro sur pastille blanche */
.bl-mb i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  color: #1b1b1b;
  font-style: normal;
  font-weight: 800;
  font-size: 7.5px;
  line-height: 11px;
  text-align: center;
  letter-spacing: -0.3px;
}

/* Bille empochée : assombrie et grisée */
.bl-mb.pris {
  filter: grayscale(1) brightness(0.4);
  opacity: 0.55;
}

/* La noire, quand elle devient la bille à jouer */
.bl-mb-8 {
  display: inline-flex;
  margin-left: 5px;
  padding: 2px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bl-or);
}

/* Table ouverte : les 15 billes sous le bandeau */
.bl-rack {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px auto 0 auto;
  padding: 4px 12px;
  background: #26302b;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bl-rack[hidden] {
  display: none;
}

.bl-rack-sep {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.2);
}

.bl-mid {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 0.78em;
  color: #c9d3cd;
  text-align: center;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  min-width: 70px;
}

.bl-mid b {
  font-family: "Madimi One", sans-serif;
  font-weight: normal;
  font-size: 1.5em;
  color: #fff;
  line-height: 1.1;
}

.bl-status {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin: 6px auto 4px auto;
  padding: 0 8px;
  font-weight: bold;
  color: #2d3a33;
  text-align: center;
  line-height: 1.25;
}

.bl-status.faute {
  color: #c62828;
}

.bl-status.bravo {
  color: #1c7a4a;
}

.bl-status.ordi {
  color: #6b7482;
}

.bl-canvas-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

#bl-canvas {
  display: block;
  max-width: 100%;
  touch-action: none;
  cursor: crosshair;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

/* ---------- Commandes (effet, force, visée fine) ---------- */

.bl-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 10px auto 0 auto;
}

.bl-controls.off {
  opacity: 0.4;
  pointer-events: none;
}

.bl-spin {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.bl-spin-ball {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #e9e6dc 55%, #b9b4a5);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.bl-spin-ball::before,
.bl-spin-ball::after {
  content: "";
  position: absolute;
  background: rgba(0, 0, 0, 0.1);
}

.bl-spin-ball::before {
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 1px;
}

.bl-spin-ball::after {
  top: 50%;
  left: 6px;
  right: 6px;
  height: 1px;
}

.bl-spin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: #d62828;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
  z-index: 1;
}

.bl-spin-lbl {
  font-size: 0.72em;
  color: #6b7482;
  margin-top: 2px;
}

.bl-rot {
  flex: none;
  width: 38px;
  height: 46px;
  border: 2px solid #c8dccf;
  border-radius: 12px;
  background: #fff;
  color: var(--bl-vert);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 4px 0;
  touch-action: none;
}

.bl-rot:hover {
  background: #eef7f1;
  border-color: var(--bl-vert);
}

.bl-power {
  position: relative;
  flex: 1;
  max-width: 420px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(#3a2414, #5a3920);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.4);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
}

.bl-power-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, #3ec46d, #f4c542 55%, #e53935);
  background-size: 420px 100%;
}

.bl-power-lbl {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

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

.bl-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(10, 30, 20, 0.55);
  animation: bl-fade 0.25s ease-out;
}

.bl-modal-box {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 24px 26px 22px 26px;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: bl-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
  user-select: text;
  -webkit-user-select: text;
}

.bl-modal-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.bl-modal-btns .bl-play {
  font-size: 1.15em;
  padding: 10px 40px;
}

.bl-modal-btns2 {
  margin-top: 14px;
}

.bl-end-title {
  font-family: "Madimi One", sans-serif;
  font-size: 2.1em;
  line-height: 1.1;
  color: #23312a;
}

.bl-end-sub {
  margin-top: 8px;
  color: #555;
  line-height: 1.4;
}

.bl-end-stats {
  margin-top: 12px;
  font-size: 0.9em;
  color: #6b7482;
}

.bl-confirm-txt {
  color: #333;
  line-height: 1.4;
}

.bl-help {
  max-width: 880px;
  text-align: left;
  line-height: 1.45;
  color: #444;
}

.bl-help ul {
  margin: 4px 0 10px 0;
  padding-left: 20px;
}

.bl-help li {
  margin: 3px 0;
}

.bl-help p {
  margin: 4px 0 10px 0;
}

.bl-help-title {
  font-family: "Madimi One", sans-serif;
  font-size: 1.35em;
  color: var(--bl-vert);
  margin-bottom: 4px;
}

.bl-help-sub {
  font-weight: bold;
  color: var(--bl-vert);
  margin-top: 8px;
}

/* Reste visible en haut quand on fait défiler l'aide */
.bl-help-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  width: 36px;
  height: 36px;
  margin: -8px -10px 0 10px;
  border: none;
  border-radius: 50%;
  background: var(--bl-vert);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.bl-help-close:hover {
  background: #22905a;
}

/* Règles des deux jeux côte à côte sur grand écran */
.bl-help-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 28px;
}

@keyframes bl-fade {
  from {
    opacity: 0;
  }
}

@keyframes bl-pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

/* ---------- Petits écrans ---------- */

@media (max-width: 520px) {
  .bl-panel {
    padding: 18px 18px 24px 18px;
  }

  .bl-player {
    padding: 4px 6px 5px 6px;
  }

  .bl-pname {
    font-size: 0.85em;
  }

  .bl-mb {
    width: 15px;
    height: 15px;
  }

  .bl-mb i {
    width: 9px;
    height: 9px;
    font-size: 6px;
    line-height: 9px;
  }

  .bl-pinfo {
    gap: 2px;
  }

  .bl-mid {
    min-width: 54px;
    padding: 4px 6px;
  }

  .bl-controls {
    gap: 6px;
  }

  .bl-rot {
    width: 32px;
  }
}

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

.bl-jeu.mg-fs {
  overflow: hidden;
}

.bl-jeu.mg-fs .bl-game {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
}

.bl-jeu.mg-fs .bl-game .bl-status {
  color: #e8efe9;
  margin: 4px auto 2px auto;
}

.bl-jeu.mg-fs .bl-game .bl-status.faute {
  color: #ff8a80;
}

.bl-jeu.mg-fs .bl-game .bl-status.bravo {
  color: #8fe3ad;
}

.bl-jeu.mg-fs .bl-game .bl-status.ordi {
  color: #b9c4bd;
}

.bl-jeu.mg-fs .bl-game .bl-canvas-wrap {
  flex: 1;
  min-height: 0;
  align-items: center;
}

.bl-jeu.mg-fs .bl-game .bl-controls {
  margin-top: 6px;
}

.bl-jeu.mg-fs .bl-game .bl-spin-lbl {
  color: #b9c4bd;
}

