/* ============================================ */
/* === MINING SYSTEM — Mars Pixel Scene ======= */
/* ============================================ */

/* --- 1. Mining Prompt (tooltip above player) --- */
.mining-prompt {
  position: absolute;
  z-index: 22;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;

  padding: 7px 14px 9px;
  background: rgba(20, 14, 8, 0.82);
  border: 1px solid rgba(255, 180, 100, 0.18);
  border-radius: 8px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  font-family: 'Courier New', monospace;
  white-space: nowrap;
}

.mining-prompt.visible {
  opacity: 1;
  transform: translateY(0);
}

/* triangle pointer at the bottom */
.mining-prompt::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(20, 14, 8, 0.82);
}

/* first line — "Pressione E" */
.mining-prompt-key {
  font-size: 11px;
  font-weight: 700;
  color: #ffc878;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

/* second line — "Para minerar" */
.mining-prompt-action {
  font-size: 9px;
  font-weight: 400;
  color: rgba(255, 190, 130, 0.55);
  letter-spacing: 0.3px;
  line-height: 1.3;
}


/* --- 2. Mining Animation on Player --- */
.player.mining {
  animation: playerMineShake 0.15s steps(2) infinite !important;
}

/* disable walk animations when mining */
.player.mining .astro-leg-l,
.player.mining .astro-leg-r,
.player.mining .astro-arm-l,
.player.mining .astro-arm-r {
  animation: none !important;
}

@keyframes playerMineShake {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1px, 0); }
  50%  { transform: translate(1px, -1px); }
  75%  { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}


/* --- 3. Pickaxe --- */
.pickaxe {
  position: absolute;
  right: -6px;
  bottom: 30px;
  width: 32px;
  height: 38px;
  z-index: 12;
  transform-origin: 10px 34px; /* pivot at the hand grip point */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.player.mining .pickaxe {
  opacity: 1;
  animation: pickaxeSwing 0.5s ease-in-out infinite;
}

/* handle — dark wood stick */
.pickaxe-handle {
  position: absolute;
  bottom: 0;
  left: 9px;
  width: 3px;
  height: 28px;
  background: linear-gradient(to bottom, #3a2a18, #2a1e12, #221810);
  border-radius: 1px;
  box-shadow: 1px 0 0 rgba(60,40,20,0.3);
}

/* head — dark iron, wider with two curved picks */
.pickaxe-head {
  position: absolute;
  top: 0;
  left: 2px;
  width: 18px;
  height: 6px;
  background: linear-gradient(to bottom, #4a4540, #2a2520);
  border-radius: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 1px 2px rgba(0,0,0,0.5);
}

/* left pick point (curved down) */
.pickaxe-head::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 10px;
  height: 5px;
  background: linear-gradient(to left, #3a3530, #1e1a16);
  clip-path: polygon(100% 0%, 0% 50%, 100% 100%);
}

/* right pick point (curved down) */
.pickaxe-head::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 10px;
  height: 5px;
  background: linear-gradient(to right, #3a3530, #1e1a16);
  clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
}

@keyframes pickaxeSwing {
  0%   { transform: rotate(-50deg); }   /* raised back, head upper-left */
  30%  { transform: rotate(-50deg); }
  42%  { transform: rotate(130deg); }   /* slammed down, head striking lower-right */
  48%  { transform: rotate(115deg); }   /* slight bounce */
  55%  { transform: rotate(122deg); }
  100% { transform: rotate(-50deg); }
}


/* --- 4. Rock Nearby Highlight --- */
.rock.nearby {
  filter: drop-shadow(0 0 4px rgba(255, 180, 100, 0.3));
  transition: filter 0.3s ease;
}

.rock.nearby svg {
  filter:
    drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 6px rgba(255, 180, 100, 0.2));
}


/* --- 5. Mining Sparks --- */
.mining-spark {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe87a, #ff9e2a);
  z-index: 23;
  pointer-events: none;
  animation: sparkFly 0.4s ease-out forwards;
  box-shadow: 0 0 4px rgba(255, 200, 60, 0.7);
}

@keyframes sparkFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--spark-x, 15px), var(--spark-y, -20px)) scale(0.3);
  }
}


/* --- 6. Mining Reward Text --- */
.mining-reward {
  position: absolute;
  z-index: 22;
  pointer-events: none;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #ffd260;
  text-shadow:
    0 0 4px rgba(255, 180, 50, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  animation: rewardFloat 1.5s ease-out forwards;
}

@keyframes rewardFloat {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}


/* --- 7. Rock Mined (fade out) --- */
.rock.mined {
  transition: all 0.5s ease;
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

/* subtle crack effect before full destruction */
.rock.cracking svg {
  filter:
    drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 3px rgba(255, 100, 30, 0.25));
  animation: rockCrack 0.12s steps(1) 3;
}

@keyframes rockCrack {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(1px, -1px); }
  100% { transform: translate(-1px, 0); }
}
