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

.dg-root {
  /* Barre commune (css/games.css) aux couleurs de la mine */
  --mg-jeu-largeur: 864px;
  --mgb-fond: radial-gradient(120% 160% at 0% 0%, rgba(80, 220, 120, 0.2), transparent 55%),
    linear-gradient(120deg, #1a0e05, #4a2c12);
  --mgb-texte: #fbeedd;
  --mgb-doux: #c9a882;
  --mgb-accent: #5ee08a;
  --mgb-titre: linear-gradient(100deg, #6cf59a, #c7f06b 50%, #ffcf4d);
  --mg-fs-fond: radial-gradient(circle at 50% 40%, #4a2c12, #1a0e05);
  --mg-bulle-fond: #2c1a0b;
  align-items: center;
}

.dg-wrap {
  position: relative;
}

#dg-canvas {
  display: block;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(70, 35, 5, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Commandes tactiles ---------- */
.dg-pad {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .dg-pad {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 520px;
    margin-top: 12px;
    padding: 0 10px;
    box-sizing: border-box;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
}

.dg-dpad {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #6b4521, #3a2410);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 2px 6px rgba(255, 255, 255, 0.12);
  touch-action: none;
}

.dg-arr {
  position: absolute;
  width: 0;
  height: 0;
  border: 9px solid transparent;
}
.dg-up {
  left: 50%;
  top: 8px;
  margin-left: -9px;
  border-bottom: 12px solid rgba(255, 220, 160, 0.55);
  border-top: 0;
}
.dg-down {
  left: 50%;
  bottom: 8px;
  margin-left: -9px;
  border-top: 12px solid rgba(255, 220, 160, 0.55);
  border-bottom: 0;
}
.dg-left {
  top: 50%;
  left: 8px;
  margin-top: -9px;
  border-right: 12px solid rgba(255, 220, 160, 0.55);
  border-left: 0;
}
.dg-right {
  top: 50%;
  right: 8px;
  margin-top: -9px;
  border-left: 12px solid rgba(255, 220, 160, 0.55);
  border-right: 0;
}

.dg-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe68a, #e0a019);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.dg-fire {
  width: 96px;
  height: 96px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb38a, #e8421c 70%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: "Madimi One", cursive;
  font-size: 22px;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
  touch-action: none;
  transition: filter 0.15s;
}

.dg-fire:active {
  transform: scale(0.95);
}

.dg-fire.dg-cool {
  filter: grayscale(0.7) brightness(0.8);
}

/* ---------- Modale d'aide ---------- */
.dg-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(40, 20, 5, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.dg-help-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f7ecdf;
  color: #7a4412;
  font-size: 16px;
  cursor: pointer;
}

.dg-help-close:hover {
  background: #eedcc6;
}

.dg-help {
  position: relative;
  max-width: 640px;
  max-height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  background: #fff;
  border-radius: 14px;
  padding: 16px 22px 18px 22px;
  color: #444;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  line-height: 1.45;
}

.dg-help-title {
  font-family: "Madimi One", cursive;
  font-size: 1.3em;
  color: #7a4412;
}

.dg-help p {
  margin: 6px 0 10px 0;
}

.dg-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 8px 16px;
  font-size: 0.92em;
}

.dg-help-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dg-ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #3a2413, #1d1108);
}

/* ---------- Plein écran ---------- */
.dg-root.mg-fs {
  justify-content: center;
  overflow: hidden;
}

/* En paysage, la croix et le bouton de tir se posent de part et d'autre du plateau */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .dg-root.mg-fs .dg-pad {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    max-width: none;
    margin: 0;
    padding: 0 18px;
    pointer-events: none;
  }
  .dg-root.mg-fs .dg-pad > * {
    pointer-events: auto;
    opacity: 0.85;
  }
}

