/* ===== Minecraft Java Edition: 3D Grass Block with Real Textures ===== */
.mc-3d-block {
  position: fixed;
  bottom: 90px;
  right: 25px;
  z-index: 995;
  width: 64px;
  height: 64px;
  perspective: 500px;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mc-3d-block:hover {
  transform: scale(1.4) translateY(-5px);
}
.mc-3d-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: mc-cube-rotate 10s linear infinite;
}
@keyframes mc-cube-rotate {
  0% { transform: rotateX(-20deg) rotateY(0deg); }
  100% { transform: rotateX(-20deg) rotateY(360deg); }
}

/* ===== Cube Faces with Real Minecraft Textures ===== */
.mc-3d-face {
  position: absolute;
  width: 64px;
  height: 64px;
  box-sizing: border-box;
  overflow: hidden;
  border: none;
  image-rendering: pixelated;
  backface-visibility: hidden;
}

/* Top face - grass top */
.mc-3d-face.top {
  transform: rotateX(90deg) translateZ(32px);
  background: url('grass_block_top.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Front face - grass side */
.mc-3d-face.front {
  transform: translateZ(32px);
  background: url('grass_block_side.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Back face - grass side */
.mc-3d-face.back {
  transform: rotateY(180deg) translateZ(32px);
  background: url('grass_block_side.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Right face - grass side */
.mc-3d-face.right {
  transform: rotateY(90deg) translateZ(32px);
  background: url('grass_block_side.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Left face - grass side */
.mc-3d-face.left {
  transform: rotateY(-90deg) translateZ(32px);
  background: url('grass_block_side.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Bottom face - dirt */
.mc-3d-face.bottom {
  transform: rotateX(-90deg) translateZ(32px);
  background: url('dirt.svg');
  background-size: 100% 100%;
  image-rendering: pixelated;
}

/* Shadow */
.mc-3d-shadow {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 12px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
  filter: blur(3px);
  animation: mc-shadow-pulse 2s ease-in-out infinite;
}
@keyframes mc-shadow-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(1.1); opacity: 0.4; }
}

/* Particle effect above block */
.mc-3d-block::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #9ccc65;
  border-radius: 50%;
  box-shadow: 0 0 6px #9ccc65;
  animation: mc-block-particle-float 3s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes mc-block-particle-float {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
  50% { transform: translateX(-50%) translateY(-15px); opacity: 0.3; }
}

/* Minecraft-style tooltip on hover */
.mc-3d-block::after {
  content: '草方块';
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(16, 16, 16, 0.95);
  border: 2px solid #2a0044;
  border-radius: 2px;
  padding: 4px 10px;
  color: #55FF55;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.5), inset 2px 2px 0 rgba(255,255,255,0.1);
}
.mc-3d-block:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Performance-based disable */
[data-perf-level="low"] .mc-3d-cube {
  animation: none !important;
  transform: rotateX(-20deg) rotateY(0deg) !important;
}
[data-perf-level="low"] .mc-3d-block::before {
  animation: none !important;
}
[data-perf-level="low"] .mc-3d-shadow {
  animation: none !important;
}
[data-perf-level="low"] .mc-3d-block::after {
  display: none !important;
}

/* Medium performance: slower rotation */
[data-perf-level="medium"] .mc-3d-cube {
  animation-duration: 30s !important;
}
[data-perf-level="medium"] .mc-3d-block::before {
  animation-duration: 6s !important;
}
[data-perf-level="medium"] .mc-3d-shadow {
  animation-duration: 4s !important;
}
