/* ========== 虚拟摇杆样式 ========== */

/* 覆盖层 - 默认隐藏 */
.joystick-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  display: none;
}

.joystick-overlay.active {
  display: block;
}

/* 摇杆底座 */
.joystick-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at center,
    rgba(30, 40, 70, 0.85) 0%,
    rgba(20, 25, 50, 0.75) 60%,
    rgba(15, 20, 40, 0.5) 100%
  );
  border: 2px solid rgba(74, 144, 217, 0.35);
  box-shadow:
    0 0 20px rgba(74, 144, 217, 0.15),
    inset 0 0 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: joystickAppear 0.15s ease-out;
}

@keyframes joystickAppear {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 摇杆旋钮 */
.joystick-knob {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    rgba(100, 160, 230, 0.9) 0%,
    rgba(74, 144, 217, 0.8) 40%,
    rgba(50, 100, 180, 0.85) 100%
  );
  border: 2px solid rgba(150, 200, 255, 0.5);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(74, 144, 217, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
  left: 50%;
  top: 50%;
  margin-left: -28px;
  margin-top: -28px;
  transition: transform 0.06s ease-out;
  z-index: 3;
}

/* 方向箭头 */
.joystick-arrow {
  position: absolute;
  font-size: 14px;
  color: rgba(180, 210, 255, 0.4);
  z-index: 2;
  transition: all 0.1s ease;
  user-select: none;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(74, 144, 217, 0.2);
}

.joystick-arrow-up {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.joystick-arrow-down {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.joystick-arrow-left {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.joystick-arrow-right {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* 箭头激活状态 */
.joystick-arrow.active {
  color: rgba(100, 200, 255, 1);
  text-shadow:
    0 0 8px rgba(100, 200, 255, 0.8),
    0 0 16px rgba(74, 144, 217, 0.5);
  font-size: 18px;
}

.joystick-arrow-up.active {
  top: 2px;
}

.joystick-arrow-down.active {
  bottom: 2px;
}

.joystick-arrow-left.active {
  left: 4px;
}

.joystick-arrow-right.active {
  right: 4px;
}

/* 十字指引线 */
.joystick-cross {
  position: absolute;
  background: rgba(74, 144, 217, 0.1);
  z-index: 1;
}

.joystick-cross-h {
  width: 60%;
  height: 1px;
  top: 50%;
  left: 20%;
  transform: translateY(-0.5px);
}

.joystick-cross-v {
  width: 1px;
  height: 60%;
  left: 50%;
  top: 20%;
  transform: translateX(-0.5px);
}

/* ========== 移动端适配 ========== */

/* 只在触摸设备上显示摇杆 */
@media (hover: hover) and (pointer: fine) {
  /* 桌面端：完全隐藏摇杆 */
  .joystick-overlay {
    display: none !important;
  }
}

/* 小屏手机适配 */
@media (max-height: 600px) {
  .joystick-base {
    width: 100px;
    height: 100px;
  }

  .joystick-knob {
    width: 46px;
    height: 46px;
    margin-left: -23px;
    margin-top: -23px;
  }

  .joystick-arrow {
    font-size: 12px;
  }

  .joystick-arrow.active {
    font-size: 15px;
  }
}
